Show / Hide Table of Contents

Interface IUnmanagedMemory<T>

Represents unmanaged memory owner.

Inherited Members
IUnmanagedMemory.Size
IUnmanagedMemory.Clear()
IUnmanagedMemory.Bytes
IUnmanagedMemory.AsStream()
ISupplier<Stream>.Invoke()
ISupplier<Stream>.NullOrDefault
IFunctional<Func<Stream>>.ToDelegate()
IMemoryOwner<T>.Memory
IDisposable.Dispose()
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 Source

this[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

index is out of range.

| Edit this page View Source

Length

Gets the number of elements in the unmanaged memory.

Declaration
int Length { get; }
Property Value
Type Description
int
| Edit this page View Source

Pointer

Gets a pointer to the allocated unmanaged memory.

Declaration
Pointer<T> Pointer { get; }
Property Value
Type Description
Pointer<T>
| Edit this page View Source

Span

Gets a span from the current instance.

Declaration
Span<T> Span { get; }
Property Value
Type Description
Span<T>
| Edit this page View Source

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 Source

Reallocate(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

length is less than or equal to zero.

NotSupportedException

Reallocation is not supported.

See Also
SupportsReallocation

Extension Methods

BasicExtensions.As<T>(T)
BasicExtensions.GetUserData<T>(T)
BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, ReadOnlySpan<T>)
ExpressionBuilder.Const<T>(T)
AsyncLockAcquisition.AcquireLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, TimeSpan, CancellationToken)
LockAcquisition.AcquireReadLock<T>(T)
LockAcquisition.AcquireReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireUpgradeableReadLock<T>(T)
LockAcquisition.AcquireUpgradeableReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireWriteLock<T>(T)
LockAcquisition.AcquireWriteLock<T>(T, TimeSpan)
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾