Struct ExSpan<T>
Provides a type-safe and memory-safe representation of a contiguous region of arbitrary memory. It can be regarded as the Span<T> of nint index range (提供任意内存的连续区域的类型安全和内存安全表示形式. 它可以被视为 nint 索引范围的 Span<T>).
public readonly ref struct ExSpan<T> : IExSpanBase<T>, IReadOnlyExSpanBase<T>, IExLength
Type Parameters
T
The element type (元素的类型).
- Implements
-
IExSpanBase<T>
- Inherited Members
- Extension Methods
Constructors
- ExSpan(void*, nint)
Creates a new ExSpan<T> over the target unmanaged buffer (在目标非托管缓冲区上创建新 ExSpan<T>).
- ExSpan(ref T)
Creates a new ExSpan<T> of length 1 around the specified reference (在指定的引用周围创建长度为 1 的新 ExSpan<T>).
- ExSpan(T[]?)
Creates a new ExSpan<T> over the entirety of the target array (在整个指定数组中创建新的 ExSpan<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>,其中包含从指定索引开始的数组的指定数量的元素).
Properties
- this[nint]
Returns the specified element of the Ex span (从扩展跨度中返回指定项).
- Length
The number of items in the Ex span (扩展跨度中的项数).
Methods
- Clear()
Clears the contents of this ExSpan.
- CopyTo(ExSpan<T>)
Copies the contents of this span into destination span. If the source and destinations overlap, this method behaves as if the original values in a temporary location before the destination is overwritten (将此跨度的内容复制到目标跨度. 如果源和目标重叠, 则此方法的行为就像覆盖目标之前临时位置中的原始值一样).
- GetEnumerator()
Gets an enumerator for this span (返回此跨度的枚举器).
- LastSlice(nint)
Forms a slice out of the given Ex span, last beginning at 'TSize' (从尾部指定索引处的扩展跨度形成切片).
- LastSlice(nint, nint)
Forms a slice out of the given Ex span, last beginning at 'end', of given length (从尾部指定长度的指定索引处开始的当前扩展跨度形成切片)
- Slice(nint)
Forms a slice out of the given Ex span, beginning at 'start' (从指定索引处开始的扩展跨度形成切片).
- Slice(nint, nint)
Forms a slice out of the given Ex span, beginning at 'start', of given length (从指定长度的指定索引处开始的当前扩展跨度形成切片).
- ToArray()
Copies the contents of this span into a new array. The maxLength parameter uses the value of ArrayMaxLengthSafe (将此范围的内容复制到新建数组中. maxLength 参数使用 ArrayMaxLengthSafe 的值).
- ToArray(int)
Copies the contents of this span into a new array. It has a maxLength parameters (将此跨度的内容复制到新建数组中. 它具有 maxLength 参数).
- ToString()
Returns the string representation of this ExSpan<T> (返回此 ExSpan<T> 的字符串表示形式).
- TryCopyTo(ExSpan<T>)
Try copies the contents of this span into destination span. If the source and destinations overlap, this method behaves as if the original values in a temporary location before the destination is overwritten (尝试将此只读跨度的内容复制到目标跨度. 如果源和目标重叠, 则此方法的行为就像覆盖目标之前临时位置中的原始值一样).
Operators
- operator ==(ExSpan<T>, ExSpan<T>)
Returns a value that indicates whether two ExSpan<T> instances are equal (返回一个值,该值指示两个 ExSpan<T> 实例是否相等).
- explicit operator Span<T>(ExSpan<T>)
Defines an explicit conversion of a ExSpan<T> to a Span<T>. The length will saturating limited to the maximum length it supports (定义 ExSpan<T> 到 Span<T> 的显式转换. 长度会饱和限制为它所支持的最大长度).
- implicit operator ExSpan<T>(ArraySegment<T>)
Defines an implicit conversion of a ArraySegment<T> to a ExSpan<T> (定义 ArraySegment<T> 到 ExSpan<T> 的隐式转换)
- implicit operator ExSpan<T>(Span<T>)
Defines an implicit conversion of a Span<T> to a ExSpan<T> (定义 Span<T> 到 ExSpan<T> 的隐式转换).
- implicit operator ReadOnlyExSpan<T>(ExSpan<T>)
Defines an implicit conversion of a ExSpan<T> to a ReadOnlyExSpan<T> (定义 ExSpan<T> 到 ReadOnlyExSpan<T> 的隐式转换).
- implicit operator ExSpan<T>(T[]?)
Defines an implicit conversion of an array to a ExSpan<T> (定义数组到 ExSpan<T> 的隐式转换)
- operator !=(ExSpan<T>, ExSpan<T>)
Returns a value that indicates whether two ExSpan<T> instances are not equal (返回一个值,该值指示两个 ExSpan<T> 实例是否不相等).