MemoryExtensions.AsStream(Memory<Byte>) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
public static System.IO.Stream AsStream (this Memory<byte> memory);
static member AsStream : Memory<byte> -> System.IO.Stream
<Extension()>
Public Function AsStream (memory As Memory(Of Byte)) As Stream
Parameters
Returns
A Stream wrapping the data within memory
.
Exceptions
Thrown when memory
has an invalid data store.
Remarks
Since this method only receives a Memory<T> instance, which does not track the lifetime of its underlying buffer, it is responsibility of the caller to manage that. In particular, the caller must ensure that the target buffer is not disposed as long as the returned Stream is in use, to avoid unexpected issues.