Search Results

Search found 1 results on 1 pages for 'pb01'.

Page 1/1 | 1 

  • C# return variables

    - by pb01
    In a debate regarding return variables, some members of the team prefer a method to return the result directly to the caller, whereas others prefer to declare a return variable that is then returned to the caller (see code examples below) The argument for the latter is that it allows a developer that is debugging the code to find the return value of the method before it returns to the caller thereby making the code easier to understand: This is especially true where method calls are daisy-chained. Are there any guidelines as to which is the most efficient and/or are there any other reasons why we should adopt one style over another? Thanks private bool Is2(int a) { return a == 2; } private bool Is3(int a) { var result = a == 3; return result; }

    Read the article

1