title: Inside a method is it the same to assign the return value to a variable first and then return it, with immediately returning it?
body: <p>a)</p>
  <pre><code>public static List&lt;T&gt; Search()
  {
     var test = GetList&lt;T&gt;(); // Potentially returning a huge number of objects
     return test;
  }
  </code></pre>
  <p>b)</p>
  <pre><code>public static List&lt;T&gt; Search() =&gt; GetList&lt;T&gt;();
  </code></pre>
  <p>Does assigning first a big number of objects to a list variable, like in first case, has any impact in performance (memory,speed etc)?</p>
  <p>My problem is that I want to measure the execution time of GetList(), without changing its code (don't have access to it) and without doing it in every reference of search. Thus, I am thinking of doing the below, but need to be sure that it won't have any negative impact anyhow:</p>
  <pre><code>public static List&lt;T&gt; Search()
  {
     var time = Stopwatch.StartNew();
     var test = GetList&lt;T&gt;(); // Returns a huge number of objects
     
     Log($&quot;Execution time: {time.ElapsedMilliseconds}&quot;);
    
     return test;
  }
  </code></pre>
  <p>The code is for making the question clearer (if that is possible).</p>