title: How do I return a class that inherits a generic list?
body: <p>I have this class:</p>
  
  <pre><code>public class CampaignMaps : List&lt;CampaignMap&gt; { };
  </code></pre>
  
  <p>The CampaignMap object is my of my own and does not inherit anything. It has your standard properties and methods.</p>
  
  <p>I then have a CampaignMapAdapter object which acts as the data to my ObjectDatasource. It has one private property for the data:</p>
  
  <pre><code>[DataObject(true)]
  public class CampaignMapAdapter
  {
    private Database db = new Database(
    ConfigurationManager.AppSettings["AppName"],
    ConfigurationManager.AppSettings["DBService"],
    ConfigurationManager.AppSettings["DBUser"]);
  
    private CampaignMaps _data
    {
      get 
      {
        CampaignMaps maps = new CampaignMaps();
        CampaignsAdapter adapter = new CampaignsAdapter();
        db.Init();
        db.AddParameter(null, null, ParameterDirection.ReturnValue, OracleType.Cursor);
        DataSet ds = db.ExecuteDataSet(PROC_GET_CAMPAIGN_MAPS);
        DataTable dt = ds.Tables[0];
        foreach (DataRow row in dt.Rows)
        {
          CampaignMap campaignMap = new CampaignMap();
          //populate the campaignMap object...
          maps.Add(campaignMap);
        }
        return maps;
      }
      set 
      {
        _data = value;
      }
    }
  
    [DataObjectMethod(DataObjectMethodType.Select, true)]
    public CampaignMaps GetFiltered(bool hasErrors)
    {
      var selectQuery = from c in _data where c.HasError == hasErrors select c;
      _data = selectQuery;
    }
  }
  </code></pre>
  
  <p><code>_data = selectQuery;</code> is throwing the error:</p>
  
  <blockquote>
    <p>Cannot implicitly convert type
    'System.Collections.Generic.IEnumerable' to
    'CampaignMaps'. An explicit conversion exists (are you missing a
    cast?)</p>
  </blockquote>
  
  <p>I suppose in plain English I want _data to always contain <strong>ALL</strong> my data elements, then calling a particular <code>select</code> should whittle them down as desired. How do I go about doing this?</p>
  
  <p>Thanks in advance.</p>