Method AsExSpan
AsExSpan(string?)
Creates a new span over the target string (在目标字符串上创建新的跨度).
public static ReadOnlyExSpan<char> AsExSpan(this string? text)
Parameters
text
stringThe 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
text
stringThe target string (目标字符串).
start
intThe index at which to begin the span (开始跨度处的索引).
length
intThe 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
text
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).
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
segment
ArraySegment<T>The target array segment (目标数组段).
Returns
- ExSpan<T>
The span representation of the array segment (数组段的跨度表示形式).
Type Parameters
T
The 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
segment
ArraySegment<T>The target array segment (目标数组段).
start
intThe index at which to begin the span (开始跨度处的索引).
length
intThe number of items in the span (跨度中的项数).
Returns
- ExSpan<T>
The span representation of the array segment (数组段的跨度表示形式).
Type Parameters
T
The element type (元素的类型).
Remarks
Returns default when segment
is null.
Exceptions
- ArrayTypeMismatchException
Thrown when
segment
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).
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
segment
ArraySegment<T>The target array segment (目标数组段).
start
intThe index at which to begin the span (开始跨度处的索引).
Returns
- ExSpan<T>
The span representation of the array segment (数组段的跨度表示形式).
Type Parameters
T
The 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
segment
ArraySegment<T>The target array segment (目标数组段).
startIndex
IndexThe starting index (起始索引).
Returns
- ExSpan<T>
The span representation of the array segment (数组段的跨度表示形式).
Type Parameters
T
The 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
segment
ArraySegment<T>The target array segment (目标数组段).
range
RangeThe range of the array segment to convert (要转换的数组段范围).
Returns
- ExSpan<T>
The span representation of the array segment (数组段的跨度表示形式).
Type Parameters
T
The 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
array
T[]The target array (目标数组).
Returns
- ExSpan<T>
The span representation of the array (数组的跨度表示形式).
Type Parameters
T
The 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
array
T[]The target array (目标数组).
start
nintThe index at which to begin the span (开始跨度处的索引).
length
nintThe number of items in the span (跨度中的项数).
Returns
- ExSpan<T>
The span representation of the array (数组的跨度表示形式).
Type Parameters
T
The element type (元素的类型).
Remarks
Returns default when array
is 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).
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
array
T[]The target array (目标数组).
start
nintThe index at which to begin the span (开始跨度处的索引).
Returns
- ExSpan<T>
The span representation of the array (数组的跨度表示形式).
Type Parameters
T
The 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
array
T[]The target array (目标数组).
startIndex
IndexThe starting index (起始索引).
Returns
- ExSpan<T>
The span representation of the array (数组的跨度表示形式).
Type Parameters
T
The 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
array
T[]The target array (目标数组).
range
RangeThe range of the array to convert (要转换的数组范围).
Returns
- ExSpan<T>
The span representation of the array (数组的跨度表示形式).
Type Parameters
T
The element type (元素的类型).
Exceptions
- ArgumentNullException
The array argument is null
AsExSpan<T>(Span<T>)
public static ExSpan<T> AsExSpan<T>(this Span<T> span)
Parameters
span
Span<T>The object to convert (要转换的对象).
Returns
Type Parameters
T
The element type (元素的类型).