Table of Contents

Class BufferExtensions

Namespace
DotCompute.Core.Memory
Assembly
DotCompute.Core.dll

Extension methods to provide compatibility with IBuffer interface changes.

public static class BufferExtensions
Inheritance
BufferExtensions
Inherited Members

Methods

GetElementCount<T>(IUnifiedMemoryBuffer<T>)

Extension method to safely get the length for any IUnifiedMemoryBuffer. This provides compatibility when IBuffer doesn't have Length property in some implementations.

public static int GetElementCount<T>(this IUnifiedMemoryBuffer<T> buffer) where T : unmanaged

Parameters

buffer IUnifiedMemoryBuffer<T>

Returns

int

Type Parameters

T

IsSafeToDispose(IDisposable)

Safe disposal check that works with both typed and untyped disposable objects.

public static bool IsSafeToDispose(this IDisposable disposable)

Parameters

disposable IDisposable

Returns

bool

SafeDispose(IDisposable)

Safe disposal that checks status first.

public static void SafeDispose(this IDisposable disposable)

Parameters

disposable IDisposable