title: Does C# optimize code automatically in looped/lambda statements?
body: <p>In Javascript for example, one is strongly encouraged to place function calls outside of loops for better performance:</p>
  
  <pre><code>var id = someIdType.ToString();
  someList.Where(a =&gt; a.id == id) ...
  </code></pre>
  
  <p>How about C#? Same case or does the compiler/runtime employ internal optimization/caching?</p>
  
  <pre><code>someList.Where(a =&gt; a.id == someIdType.ToString()) ...
  </code></pre>
  
  <p>Probably a noob question and has been asked before, but can't find a reference.</p>