title: Filtering collection with LINQ
body: <p>Let's say we have a collection of Person objects </p>
  
  <pre><code>class Person 
  {
       public string PersonName {get;set;}
       public string PersonAddress {get;set;}    
  }
  </code></pre>
  
  <p>And somewhere in the code defined collection </p>
  
  <pre><code>List&lt;Person&gt; pesonsList = new List&lt;Person&gt;();
  </code></pre>
  
  <p>We need to have a filter that need to filter the collection and return the result to the end user. Let's say we have a collection of Filter type objects</p>
  
  <pre><code>class Filter 
  {
      public string FieldName {get;set;}
      public string FilterString {get;set;}
  }
  </code></pre>
  
  <p>And somewhere in the code we have </p>
  
  <pre><code>List&lt;Filter&gt; userFilters = new List&lt;Filter&gt;(); 
  </code></pre>
  
  <p>So we need to filter the content of the personsList collection by filters defined in the userFilters collection. Where the <strong>Filter.FieldName == "PersonName" || Filter.FieldName == "PersonAddress"</strong>. How can I do that with LINQ in a cool way ? The solutions like switch/case, or 
  may be, I thought, extension method on personsList that determines from the FiledName the property of the Person to look into, are known. Something else ? Something tricky:)
  Thank you.</p>