Esempio n. 1
0
        internal static void UsageMethod()
        {
            ConcreteAggregate a = new ConcreteAggregate();

            a[0] = "Item A";
            a[1] = "Item B";
            a[2] = "Item C";
            a[3] = "Item D";
            ConcreteIterator i = new ConcreteIterator(a);

            System.Diagnostics.Debug.WriteLine("Iterating over collection:");
            string item = i.First();

            while (item != null)
            {
                System.Diagnostics.Debug.WriteLine(item);
                item = i.Next();
            }
        }
 public void UsageMethod()
 {
     ConcreteAggregate a = new ConcreteAggregate();
     a[0] = "Item A";
     a[1] = "Item B";
     a[2] = "Item C";
     a[3] = "Item D";
     ConcreteIterator i = new ConcreteIterator(a);
     System.Diagnostics.Debug.WriteLine("Iterating over collection:");
     string item = i.First();
     while (item != null)
     {
         System.Diagnostics.Debug.WriteLine(item);
         item = i.Next();
     }
 }