Method AsExSpan
AsExSpan(string?)
Creates a new span over the target string (在目标字符串上创建新的跨度).
public static ReadOnlyExSpan<char> AsExSpan(this string? text)
Parameters
textstringThe target string (目标字符串).
Returns
- ReadOnlyExSpan<char>
The span representation of the string (字符串的跨度表示形式).
AsExSpan(string?, int, int)
Creates a new span over the portion of the target string beginning at 'start' index and ending at 'end' index (exclusive) (在目标字符串中从“start”索引开始到“end”索引结束(不包括)的部分上创建一个新的跨度).
[FakeCLSCompliant(false)]
public static ReadOnlyExSpan<char> AsExSpan(this string? text, int start, int length)
Parameters
textstringThe target string (目标字符串).
startintThe index at which to begin the span (开始跨度处的索引).
lengthintThe number of items in the span (跨度中的项数).
Returns
- ReadOnlyExSpan<char>
The span representation of the string (字符串的跨度表示形式).
Remarks
Returns default when text is null.
Exceptions
- ArrayTypeMismatchException
Thrown when
textis 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).
AsExSpan(string?, int)
Creates a new span over the target string (从指定位置开始到字符串的结尾,在目标字符串的一部分上创建一个新的跨度).
[FakeCLSCompliant(false)]
public static ReadOnlyExSpan<char> AsExSpan(this string? text, int start)
Parameters
Returns
- ReadOnlyExSpan<char>
The span representation of the string (字符串的跨度表示形式).
AsExSpan(string?, Index)
Creates a new span over the portion of the target string defined by an Index value (在由 Index 值定义的目标字符串部分上创建新的跨度).
public static ReadOnlyExSpan<char> AsExSpan(this string? text, Index startIndex)
Parameters
Returns
- ReadOnlyExSpan<char>
The span representation of the string (字符串的跨度表示形式).
Exceptions
- ArgumentNullException
The array argument is null
AsExSpan(string?, Range)
Creates a new span over a portion of a target string defined by a Range value (在由 Range 值定义的目标字符串部分上创建新的跨度).
public static ReadOnlyExSpan<char> AsExSpan(this string? text, Range range)
Parameters
Returns
- ReadOnlyExSpan<char>
The span representation of the string (字符串的跨度表示形式).
Exceptions
- ArgumentNullException
The array argument is null
AsExSpan<T>(ArraySegment<T>)
Creates a new span over the target array segment (在目标数组段上创建新的跨度).
public static ExSpan<T> AsExSpan<T>(this ArraySegment<T> segment)
Parameters
segmentArraySegment<T>The target array segment (目标数组段).
Returns
- ExSpan<T>
The span representation of the array segment (数组段的跨度表示形式).
Type Parameters
TThe element type (元素的类型).
AsExSpan<T>(ArraySegment<T>, int, int)
Creates a new span over the portion of the target array segment beginning at 'start' index and ending at 'end' index (exclusive) (在目标数组段中从“start”索引开始到“end”索引结束(不包括)的部分上创建一个新的跨度).
[FakeCLSCompliant(false)]
public static ExSpan<T> AsExSpan<T>(this ArraySegment<T> segment, int start, int length)
Parameters
segmentArraySegment<T>The target array segment (目标数组段).
startintThe index at which to begin the span (开始跨度处的索引).
lengthintThe number of items in the span (跨度中的项数).
Returns
- ExSpan<T>
The span representation of the array segment (数组段的跨度表示形式).
Type Parameters
TThe element type (元素的类型).
Remarks
Returns default when segment is null.
Exceptions
- ArrayTypeMismatchException
Thrown when
segmentis 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).
AsExSpan<T>(ArraySegment<T>, int)
Creates a new span over the target array segment (从指定位置开始到数组段的结尾,在目标数组段的一部分上创建一个新的跨度).
[FakeCLSCompliant(false)]
public static ExSpan<T> AsExSpan<T>(this ArraySegment<T> segment, int start)
Parameters
segmentArraySegment<T>The target array segment (目标数组段).
startintThe index at which to begin the span (开始跨度处的索引).
Returns
- ExSpan<T>
The span representation of the array segment (数组段的跨度表示形式).
Type Parameters
TThe element type (元素的类型).
AsExSpan<T>(ArraySegment<T>, Index)
Creates a new span over the portion of the target array segment defined by an Index value (在由 Index 值定义的目标数组段部分上创建新的跨度).
public static ExSpan<T> AsExSpan<T>(this ArraySegment<T> segment, Index startIndex)
Parameters
segmentArraySegment<T>The target array segment (目标数组段).
startIndexIndexThe starting index (起始索引).
Returns
- ExSpan<T>
The span representation of the array segment (数组段的跨度表示形式).
Type Parameters
TThe element type (元素的类型).
Exceptions
- ArgumentNullException
The array argument is null
AsExSpan<T>(ArraySegment<T>, Range)
Creates a new span over a portion of a target array segment defined by a Range value (在由 Range 值定义的目标数组段部分上创建新的跨度).
public static ExSpan<T> AsExSpan<T>(this ArraySegment<T> segment, Range range)
Parameters
segmentArraySegment<T>The target array segment (目标数组段).
rangeRangeThe range of the array segment to convert (要转换的数组段范围).
Returns
- ExSpan<T>
The span representation of the array segment (数组段的跨度表示形式).
Type Parameters
TThe element type (元素的类型).
Exceptions
- ArgumentNullException
The array argument is null
AsExSpan<T>(T[]?)
Creates a new span over the target array (在目标数组上创建新的跨度).
public static ExSpan<T> AsExSpan<T>(this T[]? array)
Parameters
arrayT[]The target array (目标数组).
Returns
- ExSpan<T>
The span representation of the array (数组的跨度表示形式).
Type Parameters
TThe element type (元素的类型).
AsExSpan<T>(T[]?, nint, nint)
Creates a new span over the portion of the target array beginning at 'start' index and ending at 'end' index (exclusive) (在目标数组中从“start”索引开始到“end”索引结束(不包括)的部分上创建一个新的跨度).
[FakeCLSCompliant(false)]
public static ExSpan<T> AsExSpan<T>(this T[]? array, nint start, nint length)
Parameters
arrayT[]The target array (目标数组).
startnintThe index at which to begin the span (开始跨度处的索引).
lengthnintThe number of items in the span (跨度中的项数).
Returns
- ExSpan<T>
The span representation of the array (数组的跨度表示形式).
Type Parameters
TThe element type (元素的类型).
Remarks
Returns default when array is 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).
AsExSpan<T>(T[]?, nint)
Creates a new span over the target array (从指定位置开始到数组的结尾,在目标数组的一部分上创建一个新的跨度).
[FakeCLSCompliant(false)]
public static ExSpan<T> AsExSpan<T>(this T[]? array, nint start)
Parameters
arrayT[]The target array (目标数组).
startnintThe index at which to begin the span (开始跨度处的索引).
Returns
- ExSpan<T>
The span representation of the array (数组的跨度表示形式).
Type Parameters
TThe element type (元素的类型).
AsExSpan<T>(T[]?, Index)
Creates a new span over the portion of the target array defined by an Index value (在由 Index 值定义的目标数组部分上创建新的跨度).
public static ExSpan<T> AsExSpan<T>(this T[]? array, Index startIndex)
Parameters
arrayT[]The target array (目标数组).
startIndexIndexThe starting index (起始索引).
Returns
- ExSpan<T>
The span representation of the array (数组的跨度表示形式).
Type Parameters
TThe element type (元素的类型).
Exceptions
- ArgumentNullException
The array argument is null
AsExSpan<T>(T[]?, Range)
Creates a new span over a portion of a target array defined by a Range value (在由 Range 值定义的目标数组部分上创建新的跨度).
public static ExSpan<T> AsExSpan<T>(this T[]? array, Range range)
Parameters
arrayT[]The target array (目标数组).
rangeRangeThe range of the array to convert (要转换的数组范围).
Returns
- ExSpan<T>
The span representation of the array (数组的跨度表示形式).
Type Parameters
TThe element type (元素的类型).
Exceptions
- ArgumentNullException
The array argument is null
AsExSpan<T>(Span<T>)
public static ExSpan<T> AsExSpan<T>(this Span<T> span)
Parameters
spanSpan<T>The object to convert (要转换的对象).
Returns
Type Parameters
TThe element type (元素的类型).