コード例 #1
0
 private static void PrintInventoryItems(IInventoryIterator inventoryIterator)
 {
     while (inventoryIterator.HasNext())
     {
         Console.WriteLine(inventoryIterator.Current().GetName());
         inventoryIterator.Next();
     }
 }
コード例 #2
0
        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();
            }
        }