//  =========================================================================
//  The System.Array class acts as a common base class for all arrays.
//  If arr is some array created using Type[] arr = new Type[size] statement,
//  the length of it can be queried using arr.Length syntax.
//
//  The System.ArrayEnumerator<T> implements the System.Enumerator interface
//  for arrays so that they can be enumerated using the foreach clause.
//  =========================================================================

namespace System
{
    public class Array
    {
        public Array(int length)
        {
            this.length = length;
        }
        public int Length
        {
            get { return length; }
        }
        private int length;
    }

    public class ArrayEnumerator<T> : Enumerator
    {
        public ArrayEnumerator(T[] items)
        {
            this.items = items;
            this.index = 0;
        }
        public bool AtEnd()
        {
            if (items == null) return true;
            return index >= items.Length;
        }
        public object GetCurrent()
        {
            return items[index];
        }
        public void MoveNext()
        {
            ++index;
        }
        private T[] items;
        private int index;
    }
}