Struct PluginDisposableMemory<T>
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
Fields
IsDisposable
public byte IsDisposable
Field Value
Length
public int Length
Field Value
Properties
Empty
public static PluginDisposableMemory<T> Empty { get; }
Property Value
IsEmpty
public readonly bool IsEmpty { get; }
Property Value
this[int]
public readonly ref T this[int index] { get; }
Parameters
indexint
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
countintHow much object to allocate to unmanaged memory
isZeroedboolWhether the memory is zeroed
isDisposableboolWhether 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
AsSpan(int)
public readonly Span<T> AsSpan(int offset = 0)
Parameters
offsetint
Returns
- Span<T>
AsSpan(int, int)
public readonly Span<T> AsSpan(int offset, int length)
Parameters
Returns
- Span<T>
AsSpanPointer()
public void* AsSpanPointer()
Returns
- void*
AsStream()
public readonly UnmanagedMemoryStream AsStream()
Returns
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
memoryPluginDisposableMemory<T>