Пример #1
0
        static void Main(string[] args)
        {
            var hands    = new HandHeldInventory(new Sword(), new Shield());
            var knapsack = new KnapsackInventory(new List <Item>(new Item[] {
                new Apple(),
                new Medicine(),
                new Potion(),
                new SpellBook(),
                new Wand()
            }));

            INumerable inventory = knapsack;
            INumerator numerator = inventory.GetNumerator();

            while (!numerator.IsDone())
            {
                Console.WriteLine(numerator.CurrentItem().ToString().Split('.').Last());
                numerator.Next();
            }
        }
Пример #2
0
 public KnapsackInventoryNumerator(KnapsackInventory inventory)
 {
     _inventory = inventory;
 }