public Span(T[] array) { if (array == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array); } if (default(T) == null && array.GetInternalTypeID() != RuntimeHelpers.GetInternalTypeID <T[]>()) { ThrowHelper.ThrowArrayTypeMismatchException(); } _pointer = new ByReference <T>(ref Unsafe.As <byte, T>(ref array.GetRawSzArrayData())); _length = array.Length; }
public Span(T[] array, int start, int length) { if (array == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array); } if (default(T) == null && array.GetInternalTypeID() != RuntimeHelpers.GetInternalTypeID <T[]>()) { ThrowHelper.ThrowArrayTypeMismatchException(); } if ((uint)start > (uint)array.Length || (uint)length > (uint)(array.Length - start)) { ThrowHelper.ThrowArgumentOutOfRangeException(); } _pointer = new ByReference <T>(ref Unsafe.Add(ref Unsafe.As <byte, T>(ref array.GetRawSzArrayData()), start)); _length = length; }