title: How I can store different type of objects in a generic list in C#
body: <p>I have a requirement to add different type of objects (even though they are different, they share the same base class, they are siblings.</p>
  
  <p>Consider this class hierarchy</p>
  
  <pre><code>public abstract class Fruit
  {
      public int Quality { get; set; }
  
      public string Name { get; set; }
  
  }
  
  public sealed class Apple :Fruit
  {
      public string Color { get; set; }
  
      public Apple(string color ="Red")
      {
          Color = color;
      }
  }
  
  public sealed class Orange : Fruit
  {
      public Orange(string type = "WithSeed")
      {
          Type = type;
      }
      public string Type { get; set; }
  }
  </code></pre>
  
  <p>How can I do something like this</p>
  
  <pre><code>_apples = new List&lt;Apple&gt;
          {
              new Apple
              {
                  Name = "Fiji Apple",
                  Quality = 9,
                  Color ="Green"
              },
              new **Orange**
              {
                  Name = "Indi Orange",
                  Quality = 7,
              }
          };
  </code></pre>
  
  <p>The consumer of this generic list will use it using the base class. For example: using <code>IEnumerable&lt;Fruit&gt;</code>.
  Can someone please suggest?</p>