MemoryOwner<T>.Allocate Method

Definition

Overloads

Allocate(Int32)

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

Allocate(Int32, 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, ArrayPool<T>, AllocationMode)

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

Allocate(Int32)

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

public static Microsoft.Toolkit.HighPerformance.Buffers.MemoryOwner<T> Allocate (int size);
static member Allocate : int -> Microsoft.Toolkit.HighPerformance.Buffers.MemoryOwner<'T>
Public Shared Function Allocate (size As Integer) As MemoryOwner(Of T)

Parameters

size
Int32

The length of the new memory buffer to use.

Returns

A MemoryOwner<T> instance of the requested length.

Exceptions

Thrown when size is not valid.

Remarks

This method is just a proxy for the private constructor, for clarity.

Applies to

Allocate(Int32, AllocationMode)

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

public static Microsoft.Toolkit.HighPerformance.Buffers.MemoryOwner<T> Allocate (int size, Microsoft.Toolkit.HighPerformance.Buffers.AllocationMode mode);
static member Allocate : int * Microsoft.Toolkit.HighPerformance.Buffers.AllocationMode -> Microsoft.Toolkit.HighPerformance.Buffers.MemoryOwner<'T>
Public Shared Function Allocate (size As Integer, mode As AllocationMode) As MemoryOwner(Of T)

Parameters

size
Int32

The length of the new memory buffer to use.

mode
AllocationMode

Indicates the allocation mode to use for the new buffer to rent.

Returns

A MemoryOwner<T> instance of the requested length.

Exceptions

Thrown when size is not valid.

Remarks

This method is just a proxy for the private constructor, for clarity.

Applies to

Allocate(Int32, ArrayPool<T>)

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

public static Microsoft.Toolkit.HighPerformance.Buffers.MemoryOwner<T> Allocate (int size, System.Buffers.ArrayPool<T> pool);
static member Allocate : int * System.Buffers.ArrayPool<'T> -> Microsoft.Toolkit.HighPerformance.Buffers.MemoryOwner<'T>
Public Shared Function Allocate (size As Integer, pool As ArrayPool(Of T)) As MemoryOwner(Of T)

Parameters

size
Int32

The length of the new memory buffer to use.

pool
ArrayPool<T>

The ArrayPool<T> instance currently in use.

Returns

A MemoryOwner<T> instance of the requested length.

Exceptions

Thrown when size is not valid.

Remarks

This method is just a proxy for the private constructor, for clarity.

Applies to

Allocate(Int32, ArrayPool<T>, AllocationMode)

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

public static Microsoft.Toolkit.HighPerformance.Buffers.MemoryOwner<T> Allocate (int size, System.Buffers.ArrayPool<T> pool, Microsoft.Toolkit.HighPerformance.Buffers.AllocationMode mode);
static member Allocate : int * System.Buffers.ArrayPool<'T> * Microsoft.Toolkit.HighPerformance.Buffers.AllocationMode -> Microsoft.Toolkit.HighPerformance.Buffers.MemoryOwner<'T>
Public Shared Function Allocate (size As Integer, pool As ArrayPool(Of T), mode As AllocationMode) As MemoryOwner(Of T)

Parameters

size
Int32

The length of the new memory buffer to use.

pool
ArrayPool<T>

The ArrayPool<T> instance currently in use.

mode
AllocationMode

Indicates the allocation mode to use for the new buffer to rent.

Returns

A MemoryOwner<T> instance of the requested length.

Exceptions

Thrown when size is not valid.

Remarks

This method is just a proxy for the private constructor, for clarity.

Applies to