Class CollectionsHelper
- Namespace
- SimulationFramework
- Assembly
- SimulationFramework.dll
Provides utilities for copying data between different kinds of collections.
public static class CollectionsHelper
- Inheritance
-
CollectionsHelper
- Inherited Members
Fields
MAX_STACK_SIZE
A reasonable limit for stack allocation size.
public const int MAX_STACK_SIZE = 1024
Field Value
Methods
AsEnumerableUnsafe<T>(T*, int)
Gets an IEnumerable<T> for the provided unmanaged array.
public static IEnumerable<T> AsEnumerableUnsafe<T>(T* elements, int length) where T : unmanaged
Parameters
elements
T*A pointer to the array.
length
intThe length of the array, in elements.
Returns
- IEnumerable<T>
Type Parameters
T
The type of element to enumerate.
EnumerableAsSpan<T, TArg>(IEnumerable<T>, TArg, SpanAction<T, TArg>)
Copies an IEnumerable to a block of unmanaged memory and provides that memory to action
.
public static void EnumerableAsSpan<T, TArg>(IEnumerable<T> enumerable, TArg state, SpanAction<T, TArg> action) where T : unmanaged
Parameters
enumerable
IEnumerable<T>The source enumerable.
state
TArgA state object passed to
action
.action
SpanAction<T, TArg>The delegate to provide with the un
Type Parameters
T
The type of element to copy.
TArg
The state object type.
GetEnumeratorUnsafe<T>(T*, int)
Gets an IEnumerator<T> for the provided unmanaged array.
public static IEnumerator<T> GetEnumeratorUnsafe<T>(T* elements, int length) where T : unmanaged
Parameters
elements
T*A pointer to the array.
length
intThe length of the array, in elements.
Returns
- IEnumerator<T>
Type Parameters
T
The type of element to enumerate.