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