Method Allocate
Allocate(int)
Creates a new NatsMemoryOwner<T> instance with the specified parameters.
public static NatsMemoryOwner<T> Allocate(int size)
Parameters
size
intThe 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
intThe 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
intThe length of the new memory buffer to use.
mode
NatsMemoryOwnerAllocationModeIndicates 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
intThe length of the new memory buffer to use.
pool
ArrayPool<T>The ArrayPool<T> instance currently in use.
mode
NatsMemoryOwnerAllocationModeIndicates 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.