SequenceMarshal 类


提供与 ReadOnlySequence<T> 进行互操作的方法集合。Provides a collection of methods for interoperating with ReadOnlySequence<T>.

public ref class SequenceMarshal abstract sealed
public static class SequenceMarshal
type SequenceMarshal = class
Public Class SequenceMarshal


TryGetArray<T>(ReadOnlySequence<T>, ArraySegment<T>)

获取基础只读序列中的数组段。Gets an array segment from the underlying read-only sequence.

TryGetReadOnlyMemory<T>(ReadOnlySequence<T>, ReadOnlyMemory<T>)

尝试检索指定的只读序列中的只读内存。Attempts to retrieve a read-only memory from the specified read-only sequence.

TryGetReadOnlySequenceSegment<T>(ReadOnlySequence<T>, ReadOnlySequenceSegment<T>, Int32, ReadOnlySequenceSegment<T>, Int32)

尝试检索指定的只读序列中的只读序列段。Attempts to retrieve a read-only sequence segment from the specified read-only sequence.

TryRead<T>(SequenceReader<Byte>, T)

尝试读取缓冲区外的指定类型。Attempts to read the specified type out of the buffer. 将此方法与任意结构一起使用不太安全 - 请参阅注释以获取详细信息。It's dangerous to use this method with arbitrary structs - see remarks for more information.