예제 #1
0
 private static void PrintInventoryItems(IInventoryIterator inventoryIterator)
 {
     while (inventoryIterator.HasNext())
     {
         Console.WriteLine(inventoryIterator.Current().GetName());
         inventoryIterator.Next();
     }
 }
        private static void LoopInventory(IInventory inventory)
        {
            IInventoryIterator iterator = inventory.GetIterator();

            while (iterator.IsDone() == false)
            {
                IItem item = iterator.Current();
                //do something really cool with it
                iterator.Next();
            }
        }