Olvasás angol nyelven Szerkesztés

Megosztás a következőn keresztül:


ReadOnlyMemory<T>.Slice Method

Definition

Overloads

Slice(Int32)

Forms a slice out of the given memory region, beginning at a specified position and continuing to its end.

Slice(Int32, Int32)

Forms a slice out of the given memory region starting at start position for length elements.

Slice(Int32)

Source:
ReadOnlyMemory.cs
Source:
ReadOnlyMemory.cs
Source:
ReadOnlyMemory.cs

Forms a slice out of the given memory region, beginning at a specified position and continuing to its end.

C#
public ReadOnlyMemory<T> Slice(int start);

Parameters

start
Int32

The index at which to begin this slice.

Returns

A read-only memory region representing the desired slice.

Exceptions

start is less than 0 or greater than Length.

Applies to

.NET 10 és más verziók
Termék Verziók
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.0 (package-provided), 2.1

Slice(Int32, Int32)

Source:
ReadOnlyMemory.cs
Source:
ReadOnlyMemory.cs
Source:
ReadOnlyMemory.cs

Forms a slice out of the given memory region starting at start position for length elements.

C#
public ReadOnlyMemory<T> Slice(int start, int length);

Parameters

start
Int32

The index at which to begin this slice.

length
Int32

The desired length for the slice.

Returns

A read-only memory region representing the desired slice.

Exceptions

start, length, or start + length are outside the range of the current instance.

Applies to

.NET 10 és más verziók
Termék Verziók
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.0 (package-provided), 2.1