title: How to add items to list in c# dynamically
body: <p>Hi I am developing one mvc4 application. I came across one scenario where i want to add items ti list. I have one foreach loop inside that i have one list. 
  This is my code.</p>
  
  <pre><code>foreach (var indId in myuploadId)
  {
     List&lt;emailClass&gt; getemailDetails = objBAL.getemailDetails(indId);
     List&lt;emailClass&gt; obj = new List&lt;emailClass&gt;();
     obj.AddRange(getemailDetails);
  }
  </code></pre>
  
  <p>This is my code snippet. getemailDetails method will take some data from database and add it to obj list. On second iteration of foreach loop it gets corresponding data from database and add it to obj but here I am facing problem. Whenever i add second item to obj my first item gets disappear. Can someone tell me how can i retain information in list? Thank you.</p>