Edit

Share via


MemoryOwner<T> Class

Definition

An IMemoryOwner<T> implementation with an embedded length and a fast Span<T> accessor.

public sealed class MemoryOwner<T> : IDisposable, System.Buffers.IMemoryOwner<T>
public sealed class MemoryOwner<T> : System.Buffers.IMemoryOwner<T>
type MemoryOwner<'T> = class
    interface IMemoryOwner<'T>
    interface IDisposable
Public NotInheritable Class MemoryOwner(Of T)
Implements IDisposable, IMemoryOwner(Of T)
Public NotInheritable Class MemoryOwner(Of T)
Implements IMemoryOwner(Of T)

Type Parameters

T

The type of items to store in the current instance.

Inheritance
MemoryOwner<T>
Implements

Properties

Empty

Gets an empty MemoryOwner<T> instance.

Length

Gets the number of items in the current instance

Memory
Span

Gets a Span<T> wrapping the memory belonging to the current instance.

Methods

Allocate(Int32, AllocationMode)

Creates a new MemoryOwner<T> instance with the specified parameters.

Allocate(Int32, ArrayPool<T>, AllocationMode)

Creates a new MemoryOwner<T> instance with the specified parameters.

Allocate(Int32, ArrayPool<T>)

Creates a new MemoryOwner<T> instance with the specified parameters.

Allocate(Int32)

Creates a new MemoryOwner<T> instance with the specified parameters.

DangerousGetArray()

Gets an ArraySegment<T> instance wrapping the underlying T array in use.

DangerousGetReference()

Returns a reference to the first element within the current instance, with no bounds check.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Finalize()

Finalizes an instance of the MemoryOwner<T> class.

Slice(Int32, Int32)

Slices the buffer currently in use and returns a new MemoryOwner<T> instance.

ToString()

Returns a string that represents the current object.

Applies to