Interface IUnmanagedMemory<T>
Represents unmanaged memory owner.
Inherited Members
Namespace: DotNext.Runtime.InteropServices
Assembly: DotNext.Unsafe.dll
Syntax
[CLSCompliant(false)]
public interface IUnmanagedMemory<T> : IUnmanagedMemory, ISupplier<Stream>, IFunctional<Func<Stream>>, IMemoryOwner<T>, IDisposable, ISupplier<Memory<T>>, IFunctional<Func<Memory<T>>> where T : unmanaged
Type Parameters
Name | Description |
---|---|
T | The type of elements in the unmanaged memory. |
Properties
| Edit this page View Sourcethis[int]
Gets element of the unmanaged array.
Declaration
ref T this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the element to get. |
Property Value
Type | Description |
---|---|
T | The pointer to the array element. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException |
|
Length
Gets the number of elements in the unmanaged memory.
Declaration
int Length { get; }
Property Value
Type | Description |
---|---|
int |
Pointer
Gets a pointer to the allocated unmanaged memory.
Declaration
Pointer<T> Pointer { get; }
Property Value
Type | Description |
---|---|
Pointer<T> |
Span
Gets a span from the current instance.
Declaration
Span<T> Span { get; }
Property Value
Type | Description |
---|---|
Span<T> |
SupportsReallocation
Gets a value indicating that the referenced memory can be reallocated.
Declaration
bool SupportsReallocation { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
| Edit this page View SourceReallocate(int)
Resizes a block of memory represented by this instance.
Declaration
void Reallocate(int length)
Parameters
Type | Name | Description |
---|---|---|
int | length | The new number of elements in the unmanaged array. |
Remarks
This method is dangerous because it invalidates all buffers returned by Memory property.
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | The underlying unmanaged memory is released. |
ArgumentOutOfRangeException |
|
NotSupportedException | Reallocation is not supported. |