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.

public:
 ArraySegment<T> Slice(int index);
public ArraySegment<T> Slice (int index);
member this.Slice : int -> ArraySegment<'T>
Public Function Slice (index As Integer) As ArraySegment(Of T)

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

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.

public:
 ArraySegment<T> Slice(int index, int count);
public ArraySegment<T> Slice (int index, int count);
member this.Slice : int * int -> ArraySegment<'T>
Public Function Slice (index As Integer, count As Integer) As ArraySegment(Of T)

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