title: initiated a property with different classes from the constructor
body: <p>I have a class that have a property (<code>SearchResults</code>) that need to be <code>List&lt;T&gt;</code>, where <code>T</code> is one of my search classes depend on a condition</p>
  
  <pre><code>public class SearchGeneralResponse : ActionResponse
  {
      public IList&lt;ISearchRecord&gt; SearchResults { get; set; }
  
  
      public SearchGeneralResponse(MbsObjectType searchType)
      {
          if(searchType == MbsObjectType.SourceRepo) SearchResults = new List&lt;SearchRecord&gt;();
          if(searchType == MbsObjectType.BuildConfiguration) SearchResults = new List&lt;SearchRecordBuild&gt;();
      }
  }
  </code></pre>
  
  <p>I can cast new <code>SearchRecord</code> to <code>ISearchRecord</code>. But when I do it with list</p>
  
  <pre><code>this.SearchResults = new List&lt;SearchRecord&gt;();
  </code></pre>
  
  <p>I get this error:</p>
  
  <blockquote>
    <p>Cannot implicitly convert type System.Collections.Generic.List 'SearchRecord' to System.Collections.Generic.List 'ISearchRecord' </p>
  </blockquote>
  
  <p>Here's my interface:</p>
  
  <pre><code>public interface ISearchRecord 
  {
  
  }
  </code></pre>
  
  <p>And one of the derived classes:</p>
  
  <pre><code>public class SearchRecord : ISearchRecord
  {
      public string Name { get; set; }
  
      public string Summary { get; set; }
  
  }
  </code></pre>
  
  <p>How can I create a <code>List&lt;T&gt;</code> property that can be initialized to a list of a class depending on a certain condition?</p>