IMemoryOwnerExtensions.AsStream(IMemoryOwner<Byte>) Method

Definition

Returns a Stream wrapping the contents of the given IMemoryOwner<T> of Byte instance.

public static System.IO.Stream AsStream (this System.Buffers.IMemoryOwner<byte> memoryOwner);
static member AsStream : System.Buffers.IMemoryOwner<byte> -> System.IO.Stream
<Extension()>
Public Function AsStream (memoryOwner As IMemoryOwner(Of Byte)) As Stream

Parameters

memoryOwner
IMemoryOwner<Byte>

The input IMemoryOwner<T> of Byte instance.

Returns

A Stream wrapping the data within memoryOwner.

Exceptions

Thrown when memoryOwner has an invalid data store.

Remarks

The caller does not need to track the lifetime of the input IMemoryOwner<T> of Byte instance, as the returned Stream will take care of disposing that buffer when it is closed.

Applies to