Class ArrayHelpers
Class containing useful methods for manipulating arrays.
Namespace: Evergine.Common.Graphics
Assembly: Evergine.Common.dll
Syntax
public static class ArrayHelpers
Methods
CopyArray<T>(T[])
Copies an array.
Declaration
public static T[] CopyArray<T>(this T[] src)
Parameters
| Type | Name | Description |
|---|---|---|
| T[] | src | The source array. |
Returns
| Type | Description |
|---|---|
| T[] | The cloned array. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the array. |
EnsureArraySize<T>(ref T[], int)
Ensure that the array length is equal to the specified size. If it is not, resize the array to the specified capacity.
Declaration
public static void EnsureArraySize<T>(ref T[] array, int size)
Parameters
| Type | Name | Description |
|---|---|---|
| T[] | array | The array. |
| int | size | The capacity. |
Type Parameters
| Name | Description |
|---|---|
| T | The array type. |
EnsureCapacityPo2<T>(ref T[], int)
Ensures that the array has the specified capacity. If it does not, resizes the capacity to the next power of two value that accommodates the specified capacity.
Declaration
public static void EnsureCapacityPo2<T>(ref T[] array, int capacity)
Parameters
| Type | Name | Description |
|---|---|---|
| T[] | array | The array. |
| int | capacity | The capacity. |
Type Parameters
| Name | Description |
|---|---|
| T | The array type. |
EnsureCapacity<T>(ref T[], int)
Ensures that the array has the specified capacity. If it does not, resizes the array to the specified capacity.
Declaration
public static void EnsureCapacity<T>(ref T[] array, int capacity)
Parameters
| Type | Name | Description |
|---|---|---|
| T[] | array | The array. |
| int | capacity | The capacity. |
Type Parameters
| Name | Description |
|---|---|
| T | The array type. |