private static void TestInventory() { Inventory<Item> inv = new Inventory<Item>() { new Tuple<Item, int>(new Sword("small sword", 1), 20), new Tuple<Item, int>(new Sword("medium sword", 10), 10), new Tuple<Item, int>(new Sword("big sword", 50), 3), new Tuple<Item, int>(new Shield("wooden shield", 3), 20), new Tuple<Item, int>(new Shield("rubber shield", 10), 10), new Tuple<Item, int>(new Shield("adamantium shield", 1000), 3), new Tuple<Item, int>(new Potion("green potion", 5, Potion.PotionType.DefenseBoost), 10), new Tuple<Item, int>(new Potion("red potion", 5, Potion.PotionType.AttackBoost), 10), new Tuple<Item, int>(new Potion("blue potion", 5, Potion.PotionType.SpeedBoost), 10), new Tuple<Item, int>(new Item("Monkey Butts"), 50) }; Inventory<Sword> swords = (Inventory<Sword>)inv.GetByType<Sword>(); Inventory<Shield> shields = (Inventory<Shield>)inv.GetByType<Shield>(); Inventory<Potion> potions = (Inventory<Potion>)inv.GetByType<Potion>(); Console.WriteLine("The unfiltered inventory:"); inv.Print(); Console.ReadKey(true); Console.WriteLine("Just the swords:"); swords.Print(); Console.ReadKey(true); Console.WriteLine("Just the shields:"); shields.Print(); Console.ReadKey(true); Console.WriteLine("Just the potions:"); potions.Print(); Console.ReadKey(true); }