title: Best practice for creating objects used in for/foreach loops
body: <p>What's the best practice for dealing with objects in for or foreach loops? Should we create one object outside the loops and recreate it all over again (using new... ) or create new one for every loop iteration?<br>
  Example:   </p>
  
  <pre><code>foreach(var a in collection)
  {
    SomeClass sc = new SomeClass();
    sc.id = a;
    sc.Insert();
  }
  </code></pre>
  
  <p>or </p>
  
  <pre><code>SomeClass sc = null;
  foreach(var a in collection)
  {
    sc = new SomeClass();
    sc.id = a;
    sc.Insert();
  }
  </code></pre>
  
  <p>Which is better?</p>