C# inheritance issue to do with collections
<p>In my application I access a number of companies of different types, say TypeA, TypeB and TypeC. So I have a company class and inherited from Company is TypeA, TypeB, TypeC.</p>

<p>So I have a view where the user wants to do a search on TypeA. The search fields include fields in Company and fields in TypeA.
However if I have a collection of TypeA, say IEnumberable, how do I filter the fields in the Company class before I filter them in the TypeA class?</p>

<p>EDIT</p>

<p>So this is my pseudo code</p>

<pre><code>public abstract class Company
{
      public string Property1 { get; set; }
      public string Property2 { get; set; }

}

public class TypeA : Company
{
      public string Property3 {get; set; }
}

public class TypeB : Company
{
      public string Property4 {get; set; }
}

public abstract class SearchCompany
{
      protected SearchCompany(string searchpProperty1, string searchProperty2)
      {
           // assign property code elided
      }

      public string SearchProperty1 { get; set; }
      public string SearchProperty2 { get; set; }

}

public class SearchTypeA : SearchCompany
{
      public SearchTypeA (string searchpProperty1, string searchProperty2, string searchProperty3)
           : base (searchpProperty1, searchProperty2)
      {
          // assign property code elided
          this.TypeAList = CacheObjects.TypeAList;
          this.TypeAList = // this.TypeAList filtered by searchProperty3 depending on the wildcard
      }

      public string SearchProperty3 { get; set; }
      public IList&lt;TypeA&gt; TypeAList { get; set; }
}
</code></pre>

<p>I want to filter on properties 1 and 2 as well.</p>
