Class ArrayUtilities
Utility class for converting Array types from one type to another without copying.
Inherited Members
Namespace: Unity.SimulationPro
Assembly: Unity.SimulationPro.Capture.dll
Syntax
public static class ArrayUtilities
Methods
Allocate<T>(int)
Helper method to ensure you always allocate arrays as byte[], the reason being that the length will be unchanged when casted, so best to always use byte[].
Declaration
public static T[] Allocate<T>(int length)
Parameters
| Type | Name | Description |
|---|---|---|
| int | length | Length of the byte array. |
Returns
| Type | Description |
|---|---|
| T[] | Casted array of type |
Type Parameters
| Name | Description |
|---|---|
| T | Cast type. |
Cast<T>(Array)
Casts an input array to type T if supported by the cast map.
Declaration
public static T[] Cast<T>(Array array)
Parameters
| Type | Name | Description |
|---|---|---|
| Array | array | Input array to be casted. |
Returns
| Type | Description |
|---|---|
| T[] | Array of type T. |
Type Parameters
| Name | Description |
|---|---|
| T | Cast type. |
Count<T>(T[])
Returns actual count of a casted array.
Declaration
public static int Count<T>(T[] array)
Parameters
| Type | Name | Description |
|---|---|---|
| T[] | array | Input casted array |
Returns
| Type | Description |
|---|---|
| int | Actual count of a casted array |
Type Parameters
| Name | Description |
|---|---|
| T | Cast type. |