Table of Contents

Class MemoryExtensions

Namespace
CarinaStudio
Assembly
CarinaStudio.AppBase.Core.dll

Extensions for Memory<T>.

public static class MemoryExtensions
Inheritance
MemoryExtensions
Inherited Members

Methods

IsEmptyOrWhiteSpace(Memory<char>)

Check whether given character sequence is empty or contains whitespaces only or not.

public static bool IsEmptyOrWhiteSpace(this Memory<char> s)

Parameters

s Memory<char>

Character sequence to check.

Returns

bool

True if the character sequence is empty or contains whitespaces only.

IsEmptyOrWhiteSpace(ReadOnlyMemory<char>)

Check whether given character sequence is empty or contains whitespaces only or not.

public static bool IsEmptyOrWhiteSpace(this ReadOnlyMemory<char> s)

Parameters

s ReadOnlyMemory<char>

Character sequence to check.

Returns

bool

True if the character sequence is empty or contains whitespaces only.

IsNotEmpty<T>(Memory<T>)

Check whether given Memory<T> contains data or not.

public static bool IsNotEmpty<T>(this Memory<T> memory)

Parameters

memory Memory<T>

Memory<T> to check.

Returns

bool

True if Memory<T> contains data.

Type Parameters

T

Type of memory element.

IsNotEmpty<T>(ReadOnlyMemory<T>)

Check whether given ReadOnlyMemory<T> contains data or not.

public static bool IsNotEmpty<T>(this ReadOnlyMemory<T> memory)

Parameters

memory ReadOnlyMemory<T>

ReadOnlyMemory<T> to check.

Returns

bool

True if ReadOnlyMemory<T> contains data.

Type Parameters

T

Type of memory element.

IsNotWhiteSpace(Memory<char>)

Check whether given character sequence contains at least one non-whitespace or not.

public static bool IsNotWhiteSpace(this Memory<char> s)

Parameters

s Memory<char>

Character sequence to check.

Returns

bool

True if the character sequence contains contains at least one non-whitespace.

IsNotWhiteSpace(ReadOnlyMemory<char>)

Check whether given character sequence contains at least one non-whitespace or not.

public static bool IsNotWhiteSpace(this ReadOnlyMemory<char> s)

Parameters

s ReadOnlyMemory<char>

Character sequence to check.

Returns

bool

True if the character sequence contains contains at least one non-whitespace.

PinAs<T, TPtr>(Memory<T>, PointerAction<TPtr>)

Pin given Memory<T>, get address of memory and perform action.

public static void PinAs<T, TPtr>(this Memory<T> memory, PointerAction<TPtr> action) where TPtr : unmanaged

Parameters

memory Memory<T>

Memory<T>.

action PointerAction<TPtr>

Method to receive address of memory and perform action.

Type Parameters

T

Type of memory element.

TPtr

Type of pointer of pinned memory element.

PinAs<T, TPtr>(ReadOnlyMemory<T>, PointerAction<TPtr>)

Pin given ReadOnlyMemory<T>, get address of memory and perform action.

public static void PinAs<T, TPtr>(this ReadOnlyMemory<T> memory, PointerAction<TPtr> action) where TPtr : unmanaged

Parameters

memory ReadOnlyMemory<T>

ReadOnlyMemory<T>.

action PointerAction<TPtr>

Method to receive address of memory and perform action.

Type Parameters

T

Type of memory element.

TPtr

Type of pointer of pinned memory element.

PinAs<T, TPtr, R>(Memory<T>, PointerInFunc<TPtr, R>)

Pin given Memory<T>, get address of memory and generate a value.

public static R PinAs<T, TPtr, R>(this Memory<T> memory, PointerInFunc<TPtr, R> func) where TPtr : unmanaged

Parameters

memory Memory<T>

Memory<T>.

func PointerInFunc<TPtr, R>

Function to receive address of memory and generate value.

Returns

R

Generated value.

Type Parameters

T

Type of memory element.

TPtr

Type of pointer of pinned memory element.

R

Type of generated value.

PinAs<T, TPtr, R>(ReadOnlyMemory<T>, PointerInFunc<TPtr, R>)

Pin given ReadOnlyMemory<T>, get address of memory and generate a value.

public static R PinAs<T, TPtr, R>(this ReadOnlyMemory<T> memory, PointerInFunc<TPtr, R> func) where TPtr : unmanaged

Parameters

memory ReadOnlyMemory<T>

ReadOnlyMemory<T>.

func PointerInFunc<TPtr, R>

Function to receive address of memory and generate value.

Returns

R

Generated value.

Type Parameters

T

Type of memory element.

TPtr

Type of pointer of pinned memory element.

R

Type of generated value.

PinAs<T1, T2, TPtr1, TPtr2>((Memory<T1>, Memory<T2>), PointerAction<TPtr1, TPtr2>)

Pin given list of Memory<T>, get addresses of memory and perform action.

public static void PinAs<T1, T2, TPtr1, TPtr2>(this (Memory<T1>, Memory<T2>) memoryList, PointerAction<TPtr1, TPtr2> action) where TPtr1 : unmanaged where TPtr2 : unmanaged

Parameters

memoryList (Memory<T1>, Memory<T2>)

List of Memory<T>.

action PointerAction<TPtr1, TPtr2>

Method to receive addresses of memory and perform action.

Type Parameters

T1

Type of 1st memory element.

T2

Type of 2nd memory element.

TPtr1

Type of 1st pointer of pinned memory element.

TPtr2

Type of 2nd pointer of pinned memory element.

PinAs<T1, T2, TPtr1, TPtr2>((ReadOnlyMemory<T1>, ReadOnlyMemory<T2>), PointerAction<TPtr1, TPtr2>)

Pin given list of ReadOnlyMemory<T>, get addresses of memory and perform action.

public static void PinAs<T1, T2, TPtr1, TPtr2>(this (ReadOnlyMemory<T1>, ReadOnlyMemory<T2>) memoryList, PointerAction<TPtr1, TPtr2> action) where TPtr1 : unmanaged where TPtr2 : unmanaged

Parameters

memoryList (ReadOnlyMemory<T1>, ReadOnlyMemory<T2>)

List of ReadOnlyMemory<T>.

action PointerAction<TPtr1, TPtr2>

Method to receive addresses of memory and perform action.

Type Parameters

T1

Type of 1st memory element.

T2

Type of 2nd memory element.

TPtr1

Type of 1st pointer of pinned memory element.

TPtr2

Type of 2nd pointer of pinned memory element.

PinAs<T1, T2, TPtr1, TPtr2, R>((Memory<T1>, Memory<T2>), PointerInFunc<TPtr1, TPtr2, R>)

Pin given list of Memory<T>, get addresses of memory and generate a value.

public static R PinAs<T1, T2, TPtr1, TPtr2, R>(this (Memory<T1>, Memory<T2>) memoryList, PointerInFunc<TPtr1, TPtr2, R> func) where TPtr1 : unmanaged where TPtr2 : unmanaged

Parameters

memoryList (Memory<T1>, Memory<T2>)

List of Memory<T>.

func PointerInFunc<TPtr1, TPtr2, R>

Function to receive addresses of memory and generate value.

Returns

R

Generated value.

Type Parameters

T1

Type of 1st memory element.

T2

Type of 2nd memory element.

TPtr1

Type of 1st pointer of pinned memory element.

TPtr2

Type of 2nd pointer of pinned memory element.

R

Type of generated value.

PinAs<T1, T2, TPtr1, TPtr2, R>((ReadOnlyMemory<T1>, ReadOnlyMemory<T2>), PointerInFunc<TPtr1, TPtr2, R>)

Pin given list of ReadOnlyMemory<T>, get addresses of memory and generate a value.

public static R PinAs<T1, T2, TPtr1, TPtr2, R>(this (ReadOnlyMemory<T1>, ReadOnlyMemory<T2>) memoryList, PointerInFunc<TPtr1, TPtr2, R> func) where TPtr1 : unmanaged where TPtr2 : unmanaged

Parameters

memoryList (ReadOnlyMemory<T1>, ReadOnlyMemory<T2>)

List of ReadOnlyMemory<T>.

func PointerInFunc<TPtr1, TPtr2, R>

Function to receive addresses of memory and generate value.

Returns

R

Generated value.

Type Parameters

T1

Type of 1st memory element.

T2

Type of 2nd memory element.

TPtr1

Type of 1st pointer of pinned memory element.

TPtr2

Type of 2nd pointer of pinned memory element.

R

Type of generated value.

Pin<T>(Memory<T>, Action<IntPtr>)

Pin given Memory<T>, get address of memory and perform action.

public static void Pin<T>(this Memory<T> memory, Action<IntPtr> action)

Parameters

memory Memory<T>

Memory<T>.

action Action<IntPtr>

Method to receive address of memory and perform action.

Type Parameters

T

Type of memory element.

Pin<T>(ReadOnlyMemory<T>, Action<IntPtr>)

Pin given ReadOnlyMemory<T>, get address of memory and perform action.

public static void Pin<T>(this ReadOnlyMemory<T> memory, Action<IntPtr> action)

Parameters

memory ReadOnlyMemory<T>

ReadOnlyMemory<T>.

action Action<IntPtr>

Method to receive address of memory and perform action.

Type Parameters

T

Type of memory element.

Pin<T, R>(Memory<T>, Func<IntPtr, R>)

Pin given Memory<T>, get address of memory and generate a value.

public static R Pin<T, R>(this Memory<T> memory, Func<IntPtr, R> func)

Parameters

memory Memory<T>

Memory<T>.

func Func<IntPtr, R>

Function to receive address of memory and generate value.

Returns

R

Generated value.

Type Parameters

T

Type of memory element.

R

Type of generated value.

Pin<T, R>(ReadOnlyMemory<T>, Func<IntPtr, R>)

Pin given ReadOnlyMemory<T>, get address of memory and generate a value.

public static R Pin<T, R>(this ReadOnlyMemory<T> memory, Func<IntPtr, R> func)

Parameters

memory ReadOnlyMemory<T>

ReadOnlyMemory<T>.

func Func<IntPtr, R>

Function to receive address of memory and generate value.

Returns

R

Generated value.

Type Parameters

T

Type of memory element.

R

Type of generated value.

Pin<T1, T2>((Memory<T1>, Memory<T2>), Action<IntPtr, IntPtr>)

Pin given list of Memory<T>, get addresses of memory and perform action.

public static void Pin<T1, T2>(this (Memory<T1>, Memory<T2>) memoryList, Action<IntPtr, IntPtr> action)

Parameters

memoryList (Memory<T1>, Memory<T2>)

List of Memory<T>.

action Action<IntPtr, IntPtr>

Method to receive addresses of memory and perform action.

Type Parameters

T1

Type of 1st memory element.

T2

Type of 2nd memory element.

Pin<T1, T2>((ReadOnlyMemory<T1>, ReadOnlyMemory<T2>), Action<IntPtr, IntPtr>)

Pin given list of ReadOnlyMemory<T>, get addresses of memory and perform action.

public static void Pin<T1, T2>(this (ReadOnlyMemory<T1>, ReadOnlyMemory<T2>) memoryList, Action<IntPtr, IntPtr> action)

Parameters

memoryList (ReadOnlyMemory<T1>, ReadOnlyMemory<T2>)

List of ReadOnlyMemory<T>.

action Action<IntPtr, IntPtr>

Method to receive addresses of memory and perform action.

Type Parameters

T1

Type of 1st memory element.

T2

Type of 2nd memory element.

Pin<T1, T2, R>((Memory<T1>, Memory<T2>), Func<IntPtr, IntPtr, R>)

Pin given list of Memory<T>, get addresses of memory and generate a value.

public static R Pin<T1, T2, R>(this (Memory<T1>, Memory<T2>) memoryList, Func<IntPtr, IntPtr, R> func)

Parameters

memoryList (Memory<T1>, Memory<T2>)

List of Memory<T>.

func Func<IntPtr, IntPtr, R>

Function to receive addresses of memory and generate value.

Returns

R

Generated value.

Type Parameters

T1

Type of 1st memory element.

T2

Type of 2nd memory element.

R

Type of generated value.

Pin<T1, T2, R>((ReadOnlyMemory<T1>, ReadOnlyMemory<T2>), Func<IntPtr, IntPtr, R>)

Pin given list of ReadOnlyMemory<T>, get addresses of memory and generate a value.

public static R Pin<T1, T2, R>(this (ReadOnlyMemory<T1>, ReadOnlyMemory<T2>) memoryList, Func<IntPtr, IntPtr, R> func)

Parameters

memoryList (ReadOnlyMemory<T1>, ReadOnlyMemory<T2>)

List of ReadOnlyMemory<T>.

func Func<IntPtr, IntPtr, R>

Function to receive addresses of memory and generate value.

Returns

R

Generated value.

Type Parameters

T1

Type of 1st memory element.

T2

Type of 2nd memory element.

R

Type of generated value.