title: filtering objects from List with foreach
body: <p>Hi Ive got a list of objects but how do I filter it out to another list?</p>
  
  <p>Ex:</p>
  
  <pre><code>public class Person
  {
      public string FirstName;
      public string Language;
  
      public Person (string FirstName, string Language)
      {
          this.FirstName = FirstName;
          this.LastName = Language;            
      }
   }
  </code></pre>
  
  <p>Creates a list:</p>
  
  <pre><code>public List&lt;Person&gt; createDummyList()
  {
    List&lt;Person&gt; dummyList = new List&lt;Person&gt;();
    dummyList.Add(new Person("Per", "English"));
    dummyList.Add(new Person("Linda", "Spanish"));
  }
  </code></pre>
  
  <p>How can I get a List with just the language and then bind it to say a dropdown.? Ive tryed something like this but got a null reference...</p>
  
  <pre><code>public void filterList(List&lt;Person&gt; ListToBeFiltered)
  {
      List&lt;string&gt; LanguageList = new List&lt;string&gt;();
      ListToBeFiltered.ForEach(delegate(Person P) 
      {
         LanguageList.Add(P.Language);
      });
      DropDown.datasource = LanguageList;
      DropDown.databind();
   }
  </code></pre>
  
  <p>Anyone can point me in the right direction?</p>