共用方式為


SequenceMarshal.TryGetReadOnlyMemory<T> 方法

定義

嘗試從指定的唯讀序列擷取唯讀記憶體。

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

類型參數

T

唯讀序列的類型。

參數

sequence
ReadOnlySequence<T>

要從中擷取記憶體的唯讀序列。

memory
ReadOnlyMemory<T>

傳回的 T 類型唯讀記憶體。

傳回

若可以擷取唯讀記憶體,則為 true;否則為 false

適用於