Constructor ExSpan
ExSpan(T[]?)
public ExSpan(T[]? array)
Parameters
arrayT[]The target array (指定数组).
Remarks
Returns default when array is null (当 array 为 null 时返回默认值).
Exceptions
- ArrayTypeMismatchException
Thrown when
arrayis 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
arrayT[]The target array (指定数组).
startnintThe zero-based index at which to begin the span (从零开始的跨度索引).
lengthnintThe number of items in the span (跨度的项数).
Remarks
Returns default when array is null (当 array 为 null 时返回默认值).
Exceptions
- ArrayTypeMismatchException
Thrown when
arrayis covariant and array's type is not exactly T[].- ArgumentOutOfRangeException
Thrown when the specified
startor end index is not in the range (<0 or >Length).
ExSpan(void*, nint)
[CLSCompliant(false)]
public ExSpan(void* pointer, nint length)
Parameters
pointervoid*An unmanaged pointer to memory (指向内存的非托管指针).
lengthnintThe number of
Telements the memory contains (内存中包含的T元素数量).
Exceptions
- ArgumentException
Thrown when
Tis reference type or contains pointers and hence cannot be stored in unmanaged memory.- ArgumentOutOfRangeException
Thrown when the specified
lengthis negative.
ExSpan(ref T)
public ExSpan(ref T reference)
Parameters
referenceTA reference to data (数据的引用).