Example #1
0
        static void PrintType(TreasureBag bag, ValuableItemType type, int amount)
        {
            if (amount > 0)
            {
                Console.WriteLine($"<{type}> ${amount}");

                var itemsOfType = bag.GetItems()
                                  .Where(i => i.Type == type)
                                  .OrderByDescending(i => i.Name)
                                  .ThenBy(i => i.Quantity);

                foreach (var item in itemsOfType)
                {
                    Console.WriteLine($"##{item.Name} - {item.Quantity}");
                }
            }
        }
Example #2
0
 public ValuableItem(string name, int quantity, ValuableItemType type) : this(name, quantity)
 {
     Type = type;
 }