SequenceMarshal.TryGetArray<T> Method

Definition

Gets an array segment from the underlying read-only sequence.

public:
generic <typename T>
 static bool TryGetArray(System::Buffers::ReadOnlySequence<T> sequence, [Runtime::InteropServices::Out] ArraySegment<T> % segment);
public static bool TryGetArray<T> (System.Buffers.ReadOnlySequence<T> sequence, out ArraySegment<T> segment);
static member TryGetArray : System.Buffers.ReadOnlySequence<'T> * ArraySegment -> bool
Public Shared Function TryGetArray(Of T) (sequence As ReadOnlySequence(Of T), ByRef segment As ArraySegment(Of T)) As Boolean

Type Parameters

T

The type of the read-only sequence.

Parameters

sequence
ReadOnlySequence<T>

The read-only sequence from which the array segment will be retrieved.

segment
ArraySegment<T>

The returned array segment.

Returns

true if it's possible to retrieve the array segment; otherwise, false and a default array segment is returned.

Applies to