Beispiel #1
0
        private static void UseCircularIntList()
        {
            CircularIntList list = new CircularIntList();

            Console.WriteLine(list.Current().ToString());

            list.Add(3);
            Console.WriteLine(list.Current());

            list.Add(2);
            list.Add(1);

            Console.WriteLine(list.Current());
            list.Next();

            Console.WriteLine(list.Current());
            list.Next();

            Console.WriteLine(list.Current());
            list.Next();

            Console.WriteLine(list.Current());
            list.Next();

            Console.WriteLine(list.Current());
            list.Next();

            Console.WriteLine(list.Current());
            list.Next();


            Console.WriteLine("=== Testing foreach ===");
            foreach (int i in list)
            {
                Console.WriteLine(i);
            }
        }
 public Iterator(CircularIntList integers)
 {
     _integers    = integers;
     _numbersLeft = _integers.Count();
 }