# CollectionHelper

> Provides helper methods for collections.

## Definition

* **Type:** Class
* **Namespace:** [Unity.Collections](/engine/6000.7/script-reference/unity/collections.md)
* **Assembly:** UnityEngine.ManagedKernelModule

```csharp
public static class CollectionHelper
```

## Static Fields

| Value                                                                                                | Description                                                 |
| ---------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- |
| [CacheLineSize](/engine/6000.7/script-reference/unity/collections/collectionhelper/cachelinesize.md) | The size in bytes of the current platform's L1 cache lines. |

## Static Methods

| Method                                                                                                                                                 | Description                                                                                                                                                                                                                                                                                       |
| ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Align](/engine/6000.7/script-reference/unity/collections/collectionhelper/align.md)                                                                   | Returns an allocation size in bytes that factors in alignment.                                                                                                                                                                                                                                    |
| [CheckReflectionDataCorrect](/engine/6000.7/script-reference/unity/collections/collectionhelper/checkreflectiondatacorrect.md)                         | Checks that reflection data was properly registered for a job.                                                                                                                                                                                                                                    |
| [ConvertExistingDataToNativeArray](/engine/6000.7/script-reference/unity/collections/collectionhelper/convertexistingdatatonativearray.md)             | Convert existing data into a NativeArray.                                                                                                                                                                                                                                                         |
| [ConvertExistingNativeListToNativeArray](/engine/6000.7/script-reference/unity/collections/collectionhelper/convertexistingnativelisttonativearray.md) | Convert NativeList into a NativeArray.                                                                                                                                                                                                                                                            |
| [CreateNativeArray](/engine/6000.7/script-reference/unity/collections/collectionhelper/createnativearray.md)                                           | Create a NativeArray from a managed array, using a provided AllocatorHandle.                                                                                                                                                                                                                      |
| [CreateNativeParallelMultiHashMap](/engine/6000.7/script-reference/unity/collections/collectionhelper/createnativeparallelmultihashmap.md)             | Create a NativeParallelMultiHashMap from a managed array, using a provided Allocator.                                                                                                                                                                                                             |
| [CreateSafetyHandle](/engine/6000.7/script-reference/unity/collections/collectionhelper/createsafetyhandle.md)                                         | Creates a new AtomicSafetyHandle that is valid until [CollectionHelper.DisposeSafetyHandle](/engine/6000.7/script-reference/unity/collections/collectionhelper/disposesafetyhandle.md) is called.                                                                                                 |
| [Dispose](/engine/6000.7/script-reference/unity/collections/collectionhelper/dispose.md)                                                               | Dispose a NativeArray from an AllocatorHandle where it is allocated.                                                                                                                                                                                                                              |
| [DisposeNativeArray](/engine/6000.7/script-reference/unity/collections/collectionhelper/disposenativearray.md)                                         | Dispose a NativeArray from an AllocatorHandle where it is allocated.                                                                                                                                                                                                                              |
| [DisposeSafetyHandle](/engine/6000.7/script-reference/unity/collections/collectionhelper/disposesafetyhandle.md)                                       | Disposes a previously created AtomicSafetyHandle.                                                                                                                                                                                                                                                 |
| [Hash](/engine/6000.7/script-reference/unity/collections/collectionhelper/hash.md)                                                                     | Returns a (non-cryptographic) hash of a memory block.                                                                                                                                                                                                                                             |
| [IsAligned](/engine/6000.7/script-reference/unity/collections/collectionhelper/isaligned.md)                                                           | Returns true if an offset has a given alignment.                                                                                                                                                                                                                                                  |
| [IsPowerOfTwo](/engine/6000.7/script-reference/unity/collections/collectionhelper/ispoweroftwo.md)                                                     | Returns true if a positive value is a non-zero power of two.                                                                                                                                                                                                                                      |
| [Log2Ceil](/engine/6000.7/script-reference/unity/collections/collectionhelper/log2ceil.md)                                                             | Returns the binary logarithm of the `value`, but the result is rounded up to the nearest integer.                                                                                                                                                                                                 |
| [Log2Floor](/engine/6000.7/script-reference/unity/collections/collectionhelper/log2floor.md)                                                           | Returns the binary logarithm of the `value`, but the result is rounded down to the nearest integer.                                                                                                                                                                                               |
| [SetStaticSafetyId](/engine/6000.7/script-reference/unity/collections/collectionhelper/setstaticsafetyid.md)                                           | Assigns the provided static safety ID to an [AtomicSafetyHandle](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/atomicsafetyhandle.md). The ID's owner type name and any custom error messages are used by the job debugger when reporting errors involving the target handle. |

## Structs

| Struct                                                                                                      | Description                                       |
| ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------- |
| [CollectionHelper.DummyJob](/engine/6000.7/script-reference/unity/collections/collectionhelper/dummyjob.md) | Empty job type used for Burst compilation testing |
