ThrowArrayTypeMismatchException_ArrayTypeMustBeExactMatch() static private method

static private ThrowArrayTypeMismatchException_ArrayTypeMustBeExactMatch ( Type type ) : void
type Type
return void
Example #1
0
        public Span(T[] array)
        {
            if (array == null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
            }
            if (default(T) == null && array.GetType() != typeof(T[]))
            {
                ThrowHelper.ThrowArrayTypeMismatchException_ArrayTypeMustBeExactMatch(typeof(T));
            }

            _length     = array.Length;
            _pinnable   = Unsafe.As <Pinnable <T> >(array);
            _byteOffset = SpanHelpers.PerTypeValues <T> .ArrayAdjustment;
        }
Example #2
0
        public Memory(T[] array)
        {
            if (array == null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
            }
            if (default(T) == null && array.GetType() != typeof(T[]))
            {
                ThrowHelper.ThrowArrayTypeMismatchException_ArrayTypeMustBeExactMatch(typeof(T));
            }

            _arrayOrOwnedMemory = array;
            _index  = 0;
            _length = array.Length;
        }
Example #3
0
        public Span(T[] array, int start, int length)
        {
            if (array == null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
            }
            if (default(T) == null && array.GetType() != typeof(T[]))
            {
                ThrowHelper.ThrowArrayTypeMismatchException_ArrayTypeMustBeExactMatch(typeof(T));
            }
            if ((uint)start > (uint)array.Length || (uint)length > (uint)(array.Length - start))
            {
                ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.start);
            }

            _length     = length;
            _pinnable   = Unsafe.As <Pinnable <T> >(array);
            _byteOffset = SpanHelpers.PerTypeValues <T> .ArrayAdjustment.Add <T>(start);
        }
Example #4
0
        public Memory(T[] array, int start, int length)
        {
            if (array == null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
            }
            if (default(T) == null && array.GetType() != typeof(T[]))
            {
                ThrowHelper.ThrowArrayTypeMismatchException_ArrayTypeMustBeExactMatch(typeof(T));
            }
            if ((uint)start > (uint)array.Length || (uint)length > (uint)(array.Length - start))
            {
                ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.start);
            }

            _arrayOrOwnedMemory = array;
            _index  = start;
            _length = length;
        }