Constructor ExSpan
ExSpan(T[]?)
public ExSpan(T[]? array)
Parameters
array
T[]The target array (指定数组).
Remarks
Returns default when array
is null (当 array 为 null 时返回默认值).
Exceptions
- ArrayTypeMismatchException
Thrown when
array
is covariant and array's type is not exactly T[].
ExSpan(T[]?, nint, nint)
Creates a new ExSpan<T> over the portion of the target array beginning at 'start' index and ending at 'end' index (exclusive) (创建一个新的 ExSpan<T>,其中包含从指定索引开始的数组的指定数量的元素).
[FakeCLSCompliant(false)]
public ExSpan(T[]? array, nint start, nint length)
Parameters
array
T[]The target array (指定数组).
start
nintThe zero-based index at which to begin the span (从零开始的跨度索引).
length
nintThe number of items in the span (跨度的项数).
Remarks
Returns default when array
is null (当 array 为 null 时返回默认值).
Exceptions
- ArrayTypeMismatchException
Thrown when
array
is covariant and array's type is not exactly T[].- ArgumentOutOfRangeException
Thrown when the specified
start
or end index is not in the range (<0 or >Length).
ExSpan(void*, nint)
[CLSCompliant(false)]
public ExSpan(void* pointer, nint length)
Parameters
pointer
void*An unmanaged pointer to memory (指向内存的非托管指针).
length
nintThe number of
T
elements the memory contains (内存中包含的T
元素数量).
Exceptions
- ArgumentException
Thrown when
T
is reference type or contains pointers and hence cannot be stored in unmanaged memory.- ArgumentOutOfRangeException
Thrown when the specified
length
is negative.
ExSpan(ref T)
public ExSpan(ref T reference)
Parameters
reference
TA reference to data (数据的引用).