A collection of utility methods for working with arrays. More...
Static Public Member Functions | |
static void | Add< T > (ref T[] array, T item) |
Add one item to the array and resize it accordingly. More... | |
static T[] | AddAtStart< T > (T[] array, T item) |
Copy an array and add an array element to the start of the array. More... | |
static T[] | Clone< T > (this T[] array) |
Clone an array. More... | |
static T[][] | CreateGrid< T > (int rows, int cols) |
Create and initialize a 2-dimensional array. Instantiates rows number of arrays, each with cols number of elements. More... | |
static B[] | Map< A, B > (this A[] array, Func< A, B > map) |
Create a new array and map each element of the input array to a new value. More... | |
static B[] | Map< A, B > (this List< A > array, Func< A, B > map) |
Create a new array and map each element of the input list to a new value. More... | |
static B[] | MapRef< A, B > (this A[] array, Func< A, B > map) |
Create a new array an map each element of the input list to a new value. Different to Map<A, B>(A[], Func<A, B>) null values are preserved. More... | |
static T[] | RemoveAtStart< T > (T[] array) |
Copy an array and remove an element from the start of the array. More... | |
static T[] | Slice< T > (this T[] array, int slice) |
Copy the array but only the first slice elements. More... | |
A collection of utility methods for working with arrays.
|
inlinestatic |
Create and initialize a 2-dimensional array. Instantiates rows number of arrays, each with cols number of elements.
T | The array type |
rows | Number of rows |
cols | Number of columns |
|
inlinestatic |
Add one item to the array and resize it accordingly.
T | Array type |
array | Array to add to |
item | Item to add to the array |
|
inlinestatic |
Clone an array.
T | Array type |
array | Array to clone |
|
inlinestatic |
Copy an array and add an array element to the start of the array.
T | Array type |
array | Array to add to |
item | Item to add in from of the array |
|
inlinestatic |
Copy an array and remove an element from the start of the array.
T | Array type |
array | Array to remove from |
|
inlinestatic |
Create a new array and map each element of the input array to a new value.
A | Input array type |
B | Output array type |
array | Array to map |
map | The mapping method |
|
inlinestatic |
Create a new array and map each element of the input list to a new value.
A | Input list type |
B | Output array type |
array | List to map |
map | The mapping method |
|
inlinestatic |
Copy the array but only the first slice elements.
T | Array type |
array | Array to copy |
slice | The number of elements to copy |
|
inlinestatic |
Create a new array an map each element of the input list to a new value. Different to Map<A, B>(A[], Func<A, B>) null
values are preserved.
A | Input list type |
B | Output array type |
array | List to map |
map | The mapping method |
A | : | class | |
B | : | class |