Table of Contents

Method AsExSpan

Namespace
Zyl.ExSpans
Assembly
ExSpans.Core.dll

AsExSpan(string?)

Creates a new span over the target string (在目标字符串上创建新的跨度).

public static ReadOnlyExSpan<char> AsExSpan(this string? text)

Parameters

text string

The 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 string

The target string (目标字符串).

start int

The index at which to begin the span (开始跨度处的索引).

length int

The 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

text string

The target string (目标字符串).

start int

The index at which to begin the span (开始跨度处的索引).

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

text string

The target string (目标字符串).

startIndex Index

The starting index (起始索引).

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

text string

The target string (目标字符串).

range Range

The range of the string to convert (要转换的字符串范围).

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 int

The index at which to begin the span (开始跨度处的索引).

length int

The 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 int

The 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 Index

The 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 Range

The 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 nint

The index at which to begin the span (开始跨度处的索引).

length nint

The 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 nint

The 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 Index

The 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 Range

The 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>)

An conversion of a Span<T> to a ExSpan<T> (Span<T>ExSpan<T> 的转换).

public static ExSpan<T> AsExSpan<T>(this Span<T> span)

Parameters

span Span<T>

The object to convert (要转换的对象).

Returns

ExSpan<T>

a ExSpan<T>

Type Parameters

T

The element type (元素的类型).