MemoryOwner Class
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.
IMemoryOwner<T> wrapper which indicates the number of bytes in Memory which contain valid data. When performing reads, consumers of this class should consider ValidLength) as the length of Memory rather than using Length directly.
public class MemoryOwner : IDisposable, System.Buffers.IMemoryOwner<byte>
type MemoryOwner = class
interface IMemoryOwner<byte>
interface IDisposable
Public Class MemoryOwner
Implements IDisposable, IMemoryOwner(Of Byte)
- Inheritance
-
MemoryOwner
- Implements
Remarks
This class is used in place of IMemoryOwner<T> directly, as Rent(Int32) may return a IMemoryOwner<T> with Memory with a Length greater than the size requested.
Constructors
MemoryOwner(ArraySegment<Byte>) |
Initializes a new instance of the MemoryOwner class with the specified ArraySegment<T>. Count will be used as the initial value for ValidLength. |
MemoryOwner(Byte[], Int32) |
Initializes a new instance of the MemoryOwner class with the specified byte[] and valid length. |
MemoryOwner(IMemoryOwner<Byte>, Int32) |
Initializes a new instance of the MemoryOwner class with the specified IMemoryOwner<T> and valid length. |
Fields
ValidLength |
The number of bytes containing data in Memory. When performing reads, consumers of this class should consider ValidLength as the length of Memory rather than using Length directly. |
Properties
Memory |
See Memory. |
Methods
Dispose() |
Dispose the wrapped IMemoryOwner<T>. |
Dispose(Boolean) |
If |
Applies to
Azure SDK for .NET