Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Person p1 = new Person("King");

            Person p2 = new Person("Kong");

            Person p3 = new Person("Fing");

            PersonList pl = new PersonList();

            pl.Add(p1);
            pl.Add(p2);
            pl.Add(p3);

            PersonEnum2 pe2 = (PersonEnum2)pl.GetEnumeratorBackwards();

            foreach (Person p in pl)
            {
                Console.WriteLine("Person's name is {0}", p.Name);
            }
            Console.WriteLine("----------------------------");

            pe2.Reset();
            while (pe2.MoveNext())
            {
                Person p = (Person)pe2.Current;
                Console.WriteLine("Person's name is {0}", p.Name);
            }
        }
Ejemplo n.º 2
0
 public PersonList()
 {
     persons     = new ArrayList();
     personEnum  = new PersonEnum(persons);
     personEnum2 = new PersonEnum2(persons);
 }