Leer en inglés Editar

Compartir a través de


ArraySegment<T>.Slice Method

Definition

Overloads

Slice(Int32)

Forms a slice out of the current array segment starting at the specified index.

Slice(Int32, Int32)

Forms a slice of the specified length out of the current array segment starting at the specified index.

Slice(Int32)

Source:
ArraySegment.cs
Source:
ArraySegment.cs
Source:
ArraySegment.cs

Forms a slice out of the current array segment starting at the specified index.

C#
public ArraySegment<T> Slice(int index);

Parameters

index
Int32

The index at which to begin the slice.

Returns

An array segment that consists of all elements of the current array segment from index to the end of the array segment.

Exceptions

The underlying array of this instance is null.

index is greater than the length of the underlying array of this instance.

Applies to

.NET 10 y otras versiones
Producto Versiones
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.1

Slice(Int32, Int32)

Source:
ArraySegment.cs
Source:
ArraySegment.cs
Source:
ArraySegment.cs

Forms a slice of the specified length out of the current array segment starting at the specified index.

C#
public ArraySegment<T> Slice(int index, int count);

Parameters

index
Int32

The index at which to begin the slice.

count
Int32

The desired length of the slice.

Returns

An array segment of count elements starting at index.

Exceptions

The underlying array of this instance is null.

index is greater than the length of the underlying array of this instance.

-or-

count is greater than the length of the underlying array of this instance - index.

Applies to

.NET 10 y otras versiones
Producto Versiones
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.1