MemoryMarshal Classe

Definição

Oferece métodos para interoperar com Memory<T>, ReadOnlyMemory<T>, Span<T>e ReadOnlySpan<T>.Provides methods to interoperate with Memory<T>, ReadOnlyMemory<T>, Span<T>, and ReadOnlySpan<T>.

public ref class MemoryMarshal abstract sealed
public static class MemoryMarshal
type MemoryMarshal = class
Public Class MemoryMarshal
Herança
MemoryMarshal

Métodos

AsBytes<T>(ReadOnlySpan<T>)

Converte um ReadOnlySpan<T> de um tipo primitivo, T, em um ReadOnlySpan<Byte>.Casts a ReadOnlySpan<T> of one primitive type, T, to a ReadOnlySpan<Byte>.

AsBytes<T>(Span<T>)

Converte um Span<T> de um tipo primitivo, T, em um Span<Byte>.Casts a Span<T> of one primitive type, T, to a Span<Byte>.

AsMemory<T>(ReadOnlyMemory<T>)

Cria uma instância Memory<T> de uma ReadOnlyMemory<T>.Creates a Memory<T> instance from a ReadOnlyMemory<T>.

AsRef<T>(ReadOnlySpan<Byte>)

Reinterpreta um intervalo somente leitura de bytes como uma referência somente leitura para a estrutura do tipo T.Reinterprets a read-only span of bytes as a read-only reference to the structure of type T.

AsRef<T>(Span<Byte>)

Reinterpreta um intervalo de bytes como uma referência à estrutura do tipo T.Reinterprets a span of bytes as a reference to the structure of type T.

Cast<TFrom,TTo>(ReadOnlySpan<TFrom>)

Converte uma extensão de somente leitura de um tipo primitivo em uma extensão de outro tipo primitivo.Casts a read-only span of one primitive type to a read-only span of another primitive type.

Cast<TFrom,TTo>(Span<TFrom>)

Converte um período de um tipo primitivo em um período de outro tipo primitivo.Casts a span of one primitive type to a span of another primitive type.

CreateFromPinnedArray<T>(T[], Int32, Int32)

Cria um novo buffer de memória sobre a parte da matriz de destino pré-fixada começando pelo índice start e formado por itens length.Creates a new memory buffer over the portion of the pre-pinned target array beginning at the start index and consisting of length items.

CreateReadOnlySpan<T>(T, Int32)

Cria uma nova extensão de somente leitura sobre uma parte de um objeto gerenciado regular.Creates a new read-only span over a portion of a regular managed object.

CreateSpan<T>(T, Int32)

Cria uma nova extensão sobre uma parte de um objeto gerenciado regular.Creates a new span over a portion of a regular managed object.

GetArrayDataReference<T>(T[])

Retorna uma referência ao elemento 0 de array.Returns a reference to the 0th element of array. Se a matriz estiver vazia, retornará uma referência ao local em que o elemento 0 teria sido armazenado.If the array is empty, returns a reference to where the 0th element would have been stored. Essa referência pode ser usada para fixação, mas nunca deve ser desreferenciada.Such a reference may be used for pinning but must never be dereferenced.

GetReference<T>(ReadOnlySpan<T>)

Retorna uma referência ao elemento da extensão de somente leitura no índice 0.Returns a reference to the element of the read-only span at index 0.

GetReference<T>(Span<T>)

Retorna uma referência ao elemento da extensão no índice 0.Returns a reference to the element of the span at index 0.

Read<T>(ReadOnlySpan<Byte>)

Lê uma estrutura de tipoReads a structure of type de uma extensão de somente leitura de bytes.out of a read-only span of bytes.

ToEnumerable<T>(ReadOnlyMemory<T>)

Cria uma exibição IEnumerable<T> de determinado buffer de memória de somente leitura.Creates an IEnumerable<T> view of the given read-only memory buffer.

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

Tenta obter um segmento de matriz do buffer de memória subjacente.Tries to get an array segment from the underlying memory buffer. O valor retornado indica o sucesso da operação.The return value indicates the success of the operation.

TryGetMemoryManager<T,TManager>(ReadOnlyMemory<T>, TManager)

Tenta recuperar um MemoryManager<T> do buffer de memória de somente leitura subjacente.Tries to retrieve a MemoryManager<T> from the underlying read-only memory buffer.

TryGetMemoryManager<T,TManager>(ReadOnlyMemory<T>, TManager, Int32, Int32)

Tenta recuperar um MemoryManager<T>, índice de início e comprimento do buffer de memória de somente leitura subjacente.Tries to retrieve a MemoryManager<T>, start index, and length from the underlying read-only memory buffer.

TryGetString(ReadOnlyMemory<Char>, String, Int32, Int32)

Tenta obter a cadeia de caracteres subjacente de um System.ReadOnlyMemory<Char>.Tries to get the underlying string from a System.ReadOnlyMemory<Char>.

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

Tenta ler uma estrutura do tipo T de um intervalo de bytes somente leitura.Tries to read a structure of type T from a read-only span of bytes.

TryWrite<T>(Span<Byte>, T)

Tenta gravar uma estrutura do tipo T em um intervalo de bytes.Tries to write a structure of type T into a span of bytes.

Write<T>(Span<Byte>, T)

Grava uma estrutura do tipo T em um intervalo de bytes.Writes a structure of type T into a span of bytes.

Aplica-se a