// void CopyTo(T[] array, int arrayIndex)
        internal void CopyTo <T>(T[] array, int arrayIndex)
        {
            if (array == null)
            {
                throw new ArgumentNullException(nameof(array));
            }

            if (arrayIndex < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(arrayIndex));
            }

            if (array.Length <= arrayIndex && Count <T>() > 0)
            {
                throw new ArgumentException(SR.Argument_IndexOutOfArrayBounds);
            }

            if (array.Length - arrayIndex < Count <T>())
            {
                throw new ArgumentException(SR.Argument_InsufficientSpaceToCopyCollection);
            }


            IVector <T> _this = Unsafe.As <IVector <T> >(this);
            int         count = Count <T>();

            for (int i = 0; i < count; i++)
            {
                array[i + arrayIndex] = VectorToListAdapter.GetAt <T>(_this, (uint)i);
            }
        }
示例#2
0
        internal void CopyTo <T>(T[] array, int arrayIndex)
        {
            if (array == null)
            {
                throw new ArgumentNullException("array");
            }
            if (arrayIndex < 0)
            {
                throw new ArgumentOutOfRangeException("arrayIndex");
            }
            if (array.Length <= arrayIndex && this.Count <T>() > 0)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_IndexOutOfArrayBounds"));
            }
            if (array.Length - arrayIndex < this.Count <T>())
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_InsufficientSpaceToCopyCollection"));
            }
            IVector <T> _this = JitHelpers.UnsafeCast <IVector <T> >((object)this);
            int         num   = this.Count <T>();

            for (int index = 0; index < num; ++index)
            {
                array[index + arrayIndex] = VectorToListAdapter.GetAt <T>(_this, (uint)index);
            }
        }
        // void CopyTo(T[] array, int arrayIndex)
        internal void CopyTo <T>(T[] array, int arrayIndex)
        {
            if (array == null)
            {
                throw new ArgumentNullException(nameof(array));
            }

            if (arrayIndex < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(arrayIndex));
            }

            if (array.Length <= arrayIndex && Count <T>() > 0)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_IndexOutOfArrayBounds"));
            }

            if (array.Length - arrayIndex < Count <T>())
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_InsufficientSpaceToCopyCollection"));
            }

            Contract.EndContractBlock();

            IVector <T> _this = JitHelpers.UnsafeCast <IVector <T> >(this);
            int         count = Count <T>();

            for (int i = 0; i < count; i++)
            {
                array[i + arrayIndex] = VectorToListAdapter.GetAt <T>(_this, (uint)i);
            }
        }
示例#4
0
 internal T Indexer_Get <T>(int index)
 {
     if (index < 0)
     {
         throw new ArgumentOutOfRangeException("index");
     }
     return(VectorToListAdapter.GetAt <T>(JitHelpers.UnsafeCast <IVector <T> >((object)this), (uint)index));
 }