IMemoryOwner<T> Interface
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.
Identifies the owner of a block of memory who is responsible for disposing of the underlying memory appropriately.
generic <typename T>
public interface class IMemoryOwner : IDisposable
public interface IMemoryOwner<T> : IDisposable
type IMemoryOwner<'T> = interface
interface IDisposable
Public Interface IMemoryOwner(Of T)
Implements IDisposable
- T
The type of elements to store in memory.
- Derived
- Implements
The IMemoryOwner<T>
interface is used to define the owner responsible for the lifetime management of a Memory<T> buffer. An instance of the IMemoryOwner<T>
interface is returned by the MemoryPool<T>.Rent method.
While a buffer can have multiple consumers, it can only have a single owner at any given time. The owner can:
Create the buffer either directly or by calling a factory method.
Transfer ownership to another consumer. In this case, the previous owner should no longer use the buffer.
Destroy the buffer when it is no longer in use.
Because the IMemoryOwner<T>
object implements the IDisposable interface, you should call its Dispose method only after the memory buffer is no longer needed and you have destroyed it. You should not dispose of the IMemoryOwner<T>
object while a reference to its memory is available. This means that the type in which IMemoryOwner<T>
is declared should not have a Finalize method.
Memory |
Gets the memory belonging to this owner. |
Dispose() |
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from IDisposable) |
Produkt | Versjoner |
---|---|
.NET | Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided), 2.1 |
.NET-tilbakemelding
.NET er et åpen kilde-prosjekt. Velg en kobling for å gi tilbakemelding: