Table of Contents

Struct PluginDisposableMemory<T>

Namespace
Hi3Helper.Plugin.Core
Assembly
Hi3Helper.Plugin.Core.dll
public struct PluginDisposableMemory<T> : IDisposable where T : unmanaged

Type Parameters

T
Implements
Inherited Members
Extension Methods

Constructors

PluginDisposableMemory(T*, int, bool)

public PluginDisposableMemory(T* handle, int count, bool isDisposable = true)

Parameters

handle T*
count int
isDisposable bool

Fields

IsDisposable

public byte IsDisposable

Field Value

byte

Length

public int Length

Field Value

int

Properties

Empty

public static PluginDisposableMemory<T> Empty { get; }

Property Value

PluginDisposableMemory<T>

IsEmpty

public readonly bool IsEmpty { get; }

Property Value

bool

this[int]

public readonly ref T this[int index] { get; }

Parameters

index int

Property Value

T

Methods

Alloc(int, bool, bool)

Create and allocate span of T.

public static PluginDisposableMemory<T> Alloc(int count = 1, bool isZeroed = true, bool isDisposable = true)

Parameters

count int

How much object to allocate to unmanaged memory

isZeroed bool

Whether the memory is zeroed

isDisposable bool

Whether the

Returns

PluginDisposableMemory<T>

Disposable Span of T

AsPointer()

public readonly T* AsPointer()

Returns

T*

AsRef()

public readonly ref T AsRef()

Returns

T

AsSafePointer()

public readonly nint AsSafePointer()

Returns

nint

AsSpan(int)

public readonly Span<T> AsSpan(int offset = 0)

Parameters

offset int

Returns

Span<T>

AsSpan(int, int)

public readonly Span<T> AsSpan(int offset, int length)

Parameters

offset int
length int

Returns

Span<T>

AsSpanPointer()

public void* AsSpanPointer()

Returns

void*

AsStream()

public readonly UnmanagedMemoryStream AsStream()

Returns

UnmanagedMemoryStream

Dispose()

Dispose the handle inside the span

public void Dispose()

ForceDispose()

Forcefully freed the span, even though the object is not disposable.

public void ForceDispose()

Operators

implicit operator string?(PluginDisposableMemory<T>)

public static implicit operator string?(PluginDisposableMemory<T> memory)

Parameters

memory PluginDisposableMemory<T>

Returns

string