Show / Hide Table of Contents

Interface IUnmanagedMemory

Represents common interface for the wrapper of the unmanaged memory.

Inherited Members
IDisposable.Dispose()
Namespace: DotNext.Runtime.InteropServices
Assembly: DotNext.Unsafe.dll
Syntax
public interface IUnmanagedMemory : IDisposable, IConvertible<Stream>

Properties

| Improve this Doc View Source

Bytes

Gets a span of bytes from the current instance.

Declaration
Span<byte> Bytes { get; }
Property Value
Type Description
Span<Byte>
Exceptions
Type Condition
ObjectDisposedException

The underlying unmanaged memory has been released.

| Improve this Doc View Source

Pointer

Gets a pointer to the allocated unmanaged memory.

Declaration
Pointer<byte> Pointer { get; }
Property Value
Type Description
Pointer<Byte>
Exceptions
Type Condition
ObjectDisposedException

The underlying unmanaged memory has been released.

| Improve this Doc View Source

Size

Gets size of referenced unmanaged memory, in bytes.

Declaration
long Size { get; }
Property Value
Type Description
Int64

Methods

| Improve this Doc View Source

AsStream()

Represents unmanaged memory as stream.

Declaration
Stream AsStream()
Returns
Type Description
Stream

The stream of unmanaged memory.

Exceptions
Type Condition
ObjectDisposedException

The underlying unmanaged memory has been released.

| Improve this Doc View Source

BitwiseCompare(IUnmanagedMemory)

Bitwise comparison of the memory blocks.

Declaration
virtual int BitwiseCompare(IUnmanagedMemory other)
Parameters
Type Name Description
IUnmanagedMemory other

The block of memory to be compared.

Returns
Type Description
Int32

Comparison result which has the semantics as return type of CompareTo(Object).

Exceptions
Type Condition
ObjectDisposedException

The underlying unmanaged memory has been released.

| Improve this Doc View Source

BitwiseEquals(IUnmanagedMemory)

Computes bitwise equality between two blocks of memory.

Declaration
virtual bool BitwiseEquals(IUnmanagedMemory other)
Parameters
Type Name Description
IUnmanagedMemory other

The block of memory to be compared.

Returns
Type Description
Boolean

true, if both memory blocks have the same bytes; otherwise, false.

Exceptions
Type Condition
ObjectDisposedException

The underlying unmanaged memory has been released.

| Improve this Doc View Source

Clear()

Sets all bits of allocated memory to zero.

Declaration
virtual void Clear()
Exceptions
Type Condition
ObjectDisposedException

The underlying unmanaged memory has been released.

| Improve this Doc View Source

ReadFrom(Pointer<Byte>)

Copies bytes from the source memory to the memory identified by this object.

Declaration
virtual void ReadFrom(Pointer<byte> source)
Parameters
Type Name Description
Pointer<Byte> source

The pointer to the source unmanaged memory.

Exceptions
Type Condition
ObjectDisposedException

The underlying unmanaged memory has been released.

| Improve this Doc View Source

ReadFrom(Stream)

Copies bytes from the given stream to the memory location identified by this object asynchronously.

Declaration
virtual long ReadFrom(Stream source)
Parameters
Type Name Description
Stream source

The source stream.

Returns
Type Description
Int64
Exceptions
Type Condition
ObjectDisposedException

The underlying unmanaged memory has been released.

| Improve this Doc View Source

ReadFromAsync(Stream, CancellationToken)

Copies bytes from the given stream to the memory location identified by this object asynchronously.

Declaration
virtual ValueTask<long> ReadFromAsync(Stream source, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
Stream source

The source stream.

CancellationToken token

The token that can be used to cancel operation.

Returns
Type Description
ValueTask<Int64>
Exceptions
Type Condition
ObjectDisposedException

The underlying unmanaged memory has been released.

OperationCanceledException

The operation has been canceled.

| Improve this Doc View Source

WriteTo(Pointer<Byte>)

Copies elements from the current memory location to the specified memory location.

Declaration
virtual void WriteTo(Pointer<byte> destination)
Parameters
Type Name Description
Pointer<Byte> destination

The target memory location.

Exceptions
Type Condition
ObjectDisposedException

The underlying unmanaged memory has been released.

| Improve this Doc View Source

WriteTo(Stream)

Copies bytes from the memory location to the stream.

Declaration
virtual void WriteTo(Stream destination)
Parameters
Type Name Description
Stream destination

The destination stream.

Exceptions
Type Condition
ObjectDisposedException

The underlying unmanaged memory has been released.

| Improve this Doc View Source

WriteToAsync(Stream, CancellationToken)

Copies bytes from the memory location to the stream asynchronously.

Declaration
virtual ValueTask WriteToAsync(Stream destination, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
Stream destination

The destination stream.

CancellationToken token

The token that can be used to cancel operation.

Returns
Type Description
ValueTask

The task instance representing asynchronous state of the copying process.

Exceptions
Type Condition
ObjectDisposedException

The underlying unmanaged memory has been released.

OperationCanceledException

The operation has been canceled.

Extension Methods

AsyncLockAcquisition.AcquireLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireUpgradeableReadLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireUpgradeableReadLockAsync<T>(T, CancellationToken)
ObjectExtensions.GetUserData<T>(T)
ObjectExtensions.IsOneOf<T>(T, IEnumerable<T>)
ObjectExtensions.IsOneOf<T>(T, T[])
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, Func<T, TResult1>, Func<T, TResult2>, out TResult1, out TResult2)
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, ValueFunc<T, TResult1>, ValueFunc<T, TResult2>, out TResult1, out TResult2)
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, Func<T, TResult1>, Func<T, TResult2>)
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, ValueFunc<T, TResult1>, ValueFunc<T, TResult2>)
ObjectExtensions.As<T>(T)
LockAcquisition.AcquireReadLock<T>(T)
LockAcquisition.AcquireReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireWriteLock<T>(T)
LockAcquisition.AcquireWriteLock<T>(T, TimeSpan)
LockAcquisition.AcquireUpgradeableReadLock<T>(T)
LockAcquisition.AcquireUpgradeableReadLock<T>(T, TimeSpan)
ExpressionBuilder.Const<T>(T)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX