Table of Contents

Method DangerousGetArray

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

DangerousGetArray()

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

public ArraySegment<T> DangerousGetArray()

Returns

ArraySegment<T>

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

Remarks

This method is meant to be used when working with APIs that only accept an array as input, and should be used with caution. In particular, the returned array is rented from an array pool, and it is responsibility of the caller to ensure that it's not used after the current NatsMemoryOwner<T> instance is disposed. Doing so is considered undefined behavior, as the same array might be in use within another NatsMemoryOwner<T> instance.

Exceptions

ObjectDisposedException

Thrown when the buffer in use has already been disposed.