Ejemplo n.º 1
0
            // -----------------------------------------------------------
            // ------- Implement IEnumerable<T> interface methods --------
            // -----------------------------------------------------------
            private IEnumerator <T> GetEnumerator <T>()
            {
                T[] _this  = RuntimeHelpers.UnsafeCast <T[]>(this);
                int length = _this.length;

                return((length == 0) ? SZGenericArrayEnumerator <T> .Empty : new SZGenericArrayEnumerator <T>(_this, length));
            }
Ejemplo n.º 2
0
            private void set_Item(int index, T value)
            {
                T[] @this = RuntimeHelpers.UnsafeCast <T[]>(this);
                if ((uint)index >= (uint)@this.Length)
                {
                    throw new ArgumentOutOfRangeException("index");
                }

                @this[index] = value;
            }
Ejemplo n.º 3
0
            // -----------------------------------------------------------
            // ---------- Implement IList<T> interface methods -----------
            // -----------------------------------------------------------
            private T get_Item(int index)
            {
                T[] @this = RuntimeHelpers.UnsafeCast <T[]>(this);
                if ((uint)index >= (uint)@this.Length)
                {
                    throw new ArgumentOutOfRangeException("index");
                }

                return(@this[index]);
            }
Ejemplo n.º 4
0
            // -----------------------------------------------------------
            // ------- Implement ICollection<T> interface methods --------
            // -----------------------------------------------------------
            private void CopyTo(T[] array, int index)
            {
                if (array != null && array.Rank != 1)
                {
                    throw new ArgumentException("Multidimensional arrays are not supported");
                }

                T[] _this = RuntimeHelpers.UnsafeCast <T[]>(this);
                Array.Copy(_this, 0, array, index, _this.Length);
            }
Ejemplo n.º 5
0
 private int IndexOf(T value)
 {
     T[] @this = RuntimeHelpers.UnsafeCast <T[]>(this);
     return(Array.IndexOf(@this, value));
 }
Ejemplo n.º 6
0
 private bool Contains(T value)
 {
     T[] @this = RuntimeHelpers.UnsafeCast <T[]>(this);
     return(Array.IndexOf(@this, value) != -1);
 }
Ejemplo n.º 7
0
 private int get_Count()
 {
     T[] @this = RuntimeHelpers.UnsafeCast <T[]>(this);
     return(@this.Length);
 }
Ejemplo n.º 8
0
 // -----------------------------------------------------------
 // ------- Implement IEnumerable<T> interface methods --------
 // -----------------------------------------------------------
 private IEnumerator <T> GetEnumerator()
 {
     return(new SZGenericArrayEnumerator(RuntimeHelpers.UnsafeCast <T[]>(this)));
 }