Table of Contents

Method Allocate

Namespace
NATS.Client.Core
Assembly
NATS.Client.Core.dll

Allocate(int)

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

public static NatsMemoryOwner<T> Allocate(int size)

Parameters

size int

The length of the new memory buffer to use.

Returns

NatsMemoryOwner<T>

A NatsMemoryOwner<T> instance of the requested length.

Remarks

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

Exceptions

ArgumentOutOfRangeException

Thrown when size is not valid.

Allocate(int, ArrayPool<T>)

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

public static NatsMemoryOwner<T> Allocate(int size, ArrayPool<T> pool)

Parameters

size int

The length of the new memory buffer to use.

pool ArrayPool<T>

The ArrayPool<T> instance currently in use.

Returns

NatsMemoryOwner<T>

A NatsMemoryOwner<T> instance of the requested length.

Remarks

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

Exceptions

ArgumentOutOfRangeException

Thrown when size is not valid.

Allocate(int, NatsMemoryOwnerAllocationMode)

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

public static NatsMemoryOwner<T> Allocate(int size, NatsMemoryOwnerAllocationMode mode)

Parameters

size int

The length of the new memory buffer to use.

mode NatsMemoryOwnerAllocationMode

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

Returns

NatsMemoryOwner<T>

A NatsMemoryOwner<T> instance of the requested length.

Remarks

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

Exceptions

ArgumentOutOfRangeException

Thrown when size is not valid.

Allocate(int, ArrayPool<T>, NatsMemoryOwnerAllocationMode)

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

public static NatsMemoryOwner<T> Allocate(int size, ArrayPool<T> pool, NatsMemoryOwnerAllocationMode mode)

Parameters

size int

The length of the new memory buffer to use.

pool ArrayPool<T>

The ArrayPool<T> instance currently in use.

mode NatsMemoryOwnerAllocationMode

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

Returns

NatsMemoryOwner<T>

A NatsMemoryOwner<T> instance of the requested length.

Remarks

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

Exceptions

ArgumentOutOfRangeException

Thrown when size is not valid.