title: List of inherited classes with mixed properties
body: <p>I'm making an RPG, and I set up the item system using inherited classes, but I'm having difficulties figuring out how to get a subset of the list for a shop that allows me to filter them out using properties of all the classes.</p>
  <p>Here is a trimmed down version of what I'm running into:</p>
  <pre><code>    public class GameItem
      {
          public string strName;
          public int intQuantity;
          public int intItemType;
      }
  
      public class GeneralItem : GameItem
      {
          public int intTargetType;
      }
  
      public class EquipmentItem : GameItem
      {
          public int intAttackPower;
          public int intDefensePower;
          public int intEquipmentType;
          public bool blnEquippableByPlayer1;
      }
  
      private void GetShopItems()
      {
          Items.Add(new GeneralItem() { strName = &quot;Healing Potion&quot;, intItemType = 2, intQuantity = 10, intTargetType = 0 });
          Items.Add(new EquipmentItem() { intItemType = 0, intEquipmentType = 0, blnEquippableByPlayer1 = true, strName = &quot;Sword&quot;, intQuantity = 1, intAttackPower = 10, intDefensePower = 2 });
          Items.Add(new EquipmentItem() { intItemType = 0, intEquipmentType = 1, blnEquippableByPlayer1 = false, strName = &quot;Armor&quot;, intQuantity = 1, intAttackPower = 10, intDefensePower = 2 });
  
          //cannot convert GeneralItem to GameItemEquipment
          List&lt;GameItem&gt; ShopItems = Items.Where(x =&gt; x.intQuantity &gt; 0 &amp;&amp; ((EquipmentItem)x).blnEquippableByPlayer1).ToList(); 
      }
  </code></pre>
  <p>I need to do this because I want to display all the items regardless of type in the shop. Since all the items are not Equipment, it fails when it get to the healing potion.</p>