title: Declare a List of unknown type and assign the value based on the selection
body: <p>I have different types of lists, and based on the selected list, my grid needs to be populated. These list item classes are defined as follows:</p>
  
  <pre><code>public class plist
  {
      public DateTime date_modified { get; set; }
      public DateTime date_added { get; set; }
  }
  
  public class cList1 :plist
  {
      public string code { get; set; }
      public string name { get; set; }
  }
  
  public class cList2 : plist
  {
      public string typename { get; set; }
      public int typecode { get; set; }
  }
  </code></pre>
  
  <p>In my web page, I need to populate the control based on the list selected <code>clist1</code> or <code>clist2</code>.</p>
  
  <pre><code>protected void Page_Load(object s,EventArgs e)
  {
      List&lt;cList1&gt; codes = new List&lt;cList1&gt;();
      List&lt;cList2&gt; types = new List&lt;cList2&gt;();
  
      switch (getGrpSelValue())
      {
          case (int)LookupType.LU1:
              codes = getMyCodes(0, null, null);
              bindMyGrid(cList1, masterGrd);
              break;
          case (int)LookupType.LU2:
              types = getMyTypes(0, null, null);
              bindMyGrid(cList2, masterGrd);
              break;
          default:
              break;
      }
  }
  
  public void bindMyGrid&lt;T&gt;(List&lt;T&gt; list, GridView gv)
  {
      //binds the grid here
  }
  </code></pre>
  
  <p>Is there a way to declare one generic list object and then assign code or types to it and call <code>bindMyGrid</code> method once?</p>