StringSegment.AsSpan Method

Definition

Overloads

AsSpan()

Gets a ReadOnlySpan<T> from the current StringSegment.

AsSpan(Int32)

Gets a ReadOnlySpan<T> from the current StringSegment that starts at the position specified by start, and has the remaining length.

AsSpan(Int32, Int32)

Gets a ReadOnlySpan<T> from the current StringSegment that starts at the position specified by start, and has the specified length.

AsSpan()

Source:
StringSegment.cs
Source:
StringSegment.cs
Source:
StringSegment.cs

Gets a ReadOnlySpan<T> from the current StringSegment.

C#
public ReadOnlySpan<char> AsSpan();

Returns

The ReadOnlySpan<T> from this StringSegment.

Applies to

.NET 10 (package-provided) e altre versioni
Prodotto Versioni
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)

AsSpan(Int32)

Source:
StringSegment.cs
Source:
StringSegment.cs
Source:
StringSegment.cs

Gets a ReadOnlySpan<T> from the current StringSegment that starts at the position specified by start, and has the remaining length.

C#
public ReadOnlySpan<char> AsSpan(int start);

Parameters

start
Int32

The zero-based starting character position in this StringSegment.

Returns

A ReadOnlySpan<T> with the remaining chars that begins at start in this StringSegment.

Exceptions

start is greater than or equal to Length or less than zero.

Applies to

.NET 10 (package-provided) e altre versioni
Prodotto Versioni
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)

AsSpan(Int32, Int32)

Source:
StringSegment.cs
Source:
StringSegment.cs
Source:
StringSegment.cs

Gets a ReadOnlySpan<T> from the current StringSegment that starts at the position specified by start, and has the specified length.

C#
public ReadOnlySpan<char> AsSpan(int start, int length);

Parameters

start
Int32

The zero-based starting character position in this StringSegment.

length
Int32

The number of characters in the span.

Returns

A ReadOnlySpan<T> with length that begins at start in this StringSegment.

Exceptions

start or length is less than zero, or start + length is greater than Length.

Applies to

.NET 10 (package-provided) e altre versioni
Prodotto Versioni
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)