Class UnsafeCollectionUtility
- Namespace
- Misaki.HighPerformance.LowLevel.Utilities
- Assembly
- Misaki.HighPerformance.LowLevel.dll
Provides extension methods for copying elements between unsafe collections and spans, converting collections to arrays or lists, and searching for values.
public static class UnsafeCollectionUtility
- Inheritance
-
UnsafeCollectionUtility
- Inherited Members
Methods
ToUnsafeArray<T>(T[], AllocationHandle)
Converts a managed array to an UnsafeArray by copying its elements to unmanaged memory.
public static UnsafeArray<T> ToUnsafeArray<T>(this T[] source, AllocationHandle allocationHandle) where T : unmanaged
Parameters
sourceT[]The managed array to convert.
allocationHandleAllocationHandleThe allocation handle to use for memory allocation of the UnsafeArray.
Returns
- UnsafeArray<T>
A new UnsafeArray containing a copy of the source array elements.
Type Parameters
TThe type of elements in the array, which must be unmanaged.
ToUnsafeList<T>(List<T>, AllocationHandle)
Converts a managed List to an UnsafeList by copying its elements to unmanaged memory.
public static UnsafeList<T> ToUnsafeList<T>(this List<T> source, AllocationHandle allocationHandle) where T : unmanaged
Parameters
sourceList<T>The managed List to convert.
allocationHandleAllocationHandleThe allocation handle to use for memory allocation of the UnsafeList.
Returns
- UnsafeList<T>
A new UnsafeList containing a copy of the source list elements.
Type Parameters
TThe type of elements in the list, which must be unmanaged.