Пример #1
0
        static void Main(string[] args)
        {
            SmartArray smarty = new SmartArray(4);

            for (int i = 0; i < 8; i++)
            {
                smarty.Add(i);
            }

            DisplaySmartArrayToConsole(smarty);

            IEnumerator enumerator = smarty.GetEnumerator();

            while (enumerator.MoveNext())
            {
                int current = (int)enumerator.Current;
                Console.Write("{0} ", current);
            }
            Console.WriteLine();

            for (int i = 0; i < 8; i++)
            {
                Console.WriteLine("Removing " + i);
                smarty.Remove(i);
                DisplaySmartArrayToConsole(smarty);
            }
        }
Пример #2
0
 private static void DisplaySmartArrayToConsole(SmartArray array)
 {
     foreach (int i in array)
     {
         Console.Write("{0} ", i);
     }
     Console.WriteLine();
 }
 public SmartEnumerator(SmartArray smarty)
 {
     this.smarty = smarty;
 }