예제 #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));
            }
예제 #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;
            }
예제 #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]);
            }
예제 #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);
            }
예제 #5
0
 private int IndexOf(T value)
 {
     T[] @this = RuntimeHelpers.UnsafeCast <T[]>(this);
     return(Array.IndexOf(@this, value));
 }
예제 #6
0
 private bool Contains(T value)
 {
     T[] @this = RuntimeHelpers.UnsafeCast <T[]>(this);
     return(Array.IndexOf(@this, value) != -1);
 }
예제 #7
0
 private int get_Count()
 {
     T[] @this = RuntimeHelpers.UnsafeCast <T[]>(this);
     return(@this.Length);
 }
예제 #8
0
 // -----------------------------------------------------------
 // ------- Implement IEnumerable<T> interface methods --------
 // -----------------------------------------------------------
 private IEnumerator <T> GetEnumerator()
 {
     return(new SZGenericArrayEnumerator(RuntimeHelpers.UnsafeCast <T[]>(this)));
 }