Table of Contents

Class UnsafeHelper

Namespace
HelixToolkit.SharpDX.Utilities
Assembly
HelixToolkit.SharpDX.dll
public static class UnsafeHelper
Inheritance
UnsafeHelper
Inherited Members

Methods

ClearMemory(nint, int)

Clears the memory.

public static void ClearMemory(nint dest, int sizeInBytesToClear)

Parameters

dest nint

The dest.

sizeInBytesToClear int

The size in bytes to clear.

MemoryCopy(nint, nint, int)

Unsafe memory copy

public static void MemoryCopy(nint dst, nint src, int sizeInBytes)

Parameters

dst nint
src nint
sizeInBytes int

ReadAndPosition<T>(nint, ref T)

Reads the specified T data from a memory location.

public static nint ReadAndPosition<T>(nint source, ref T data) where T : unmanaged

Parameters

source nint

Memory location to read from.

data T

The data write to.

Returns

nint

source pointer + sizeof(T).

Type Parameters

T

Type of a data to read.

ReadOut<T>(nint, out T)

Reads the specified T data from a memory location.

public static void ReadOut<T>(nint source, out T data) where T : unmanaged

Parameters

source nint

Memory location to read from.

data T

The data write to.

Type Parameters

T

Type of a data to read.

Read<T>(nint)

Reads the specified T data from a memory location.

public static T Read<T>(nint source) where T : unmanaged

Parameters

source nint

Memory location to read from.

Returns

T

The data read from the memory location.

Type Parameters

T

Type of a data to read.

Read<T>(nint, ref T)

Reads the specified T data from a memory location.

public static void Read<T>(nint source, ref T data) where T : unmanaged

Parameters

source nint

Memory location to read from.

data T

The data write to.

Type Parameters

T

Type of a data to read.

Read<T>(nint, T[], int, int)

Reads the specified array T[] data from a memory location.

public static nint Read<T>(nint source, T[] data, int offset, int count) where T : unmanaged

Parameters

source nint

Memory location to read from.

data T[]

The data write to.

offset int

The offset in the array to write to.

count int

The number of T element to read from the memory location.

Returns

nint

source pointer + sizeof(T) * count.

Type Parameters

T

Type of a data to read.

SizeOf<T>()

public static int SizeOf<T>() where T : unmanaged

Returns

int

Type Parameters

T

SizeOf<T>(ref T)

public static int SizeOf<T>(ref T _) where T : unmanaged

Parameters

_ T

Returns

int

Type Parameters

T

SizeOf<T>(T[])

public static int SizeOf<T>(T[] array) where T : unmanaged

Parameters

array T[]

Returns

int

Type Parameters

T

Write(nint, nint, int, int)

public static nint Write(nint destination, nint data, int offset, int count)

Parameters

destination nint
data nint
offset int

By bytes

count int

By bytes

Returns

nint

Write<T>(nint, T)

Writes the specified T data to a memory location.

public static nint Write<T>(nint destination, T data) where T : unmanaged

Parameters

destination nint

Memory location to write to.

data T

The data to write.

Returns

nint

destination pointer + sizeof(T).

Type Parameters

T

Type of a data to write.

Write<T>(nint, ref T)

Writes the specified T data to a memory location.

public static nint Write<T>(nint destination, ref T data) where T : unmanaged

Parameters

destination nint

Memory location to write to.

data T

The data to write.

Returns

nint

destination pointer + sizeof(T).

Type Parameters

T

Type of a data to write.

Write<T>(nint, T[], int, int)

Writes the specified array T[] data to a memory location.

public static nint Write<T>(nint destination, T[] data, int offset, int count) where T : unmanaged

Parameters

destination nint

Memory location to write to.

data T[]

The array of T data to write.

offset int

The offset in the array to read from.

count int

The number of T element to write to the memory location.

Returns

nint

destination pointer + sizeof(T) * count.

Type Parameters

T

Type of a data to write.