ArrayExtensions

Static Class in Zigurous.Architecture

Declaration

public static class ArrayExtensions

Description

Extension methods for arrays.

Extension Methods

Append<T>Appends an element to the end of the array.
Concat<T>Concats an array of elements to the end of the array.
Contains<T>Checks if the array contains the given element.
ContainsAll<T>Checks if the array contains all elements that satisfy a predicate.
ElementAt<T>Returns the element at the specified index.
Filter<T>Filters the array to only contain elements that satisfy a predicate.
First<T>Returns the first element in the array.
FirstNonNull<T>Returns the first non-null element in the array.
Flatten<T>Flattens a two-dimensional array into a new one-dimensional array.
For<T>Invokes an action for each element in the array. The element and index are passed as parameters.
ForEach<T>Invokes an action for each element in the array. The element is passed as a parameter.
IndexOf<T>Returns the index of the given element in the array.
IsEmptyChecks if the array is empty.
IsNotEmptyChecks if the array is not empty.
IsInBoundsChecks if the specified index is within the bounds of the array.
IsNotInBoundsChecks if the specified index is out of bounds of the array.
Join<T>Joins the elements of the array into a string with a delimiter.
Last<T>Returns the last element in the array.
LastNonNull<T>Returns the last non-null element in the array.
Map<TInput, TOutput>Maps the elements of the array to a new array using a converter function.
NonNull<T>Filters out all null elements from the array.
Random<T>Returns a random element from the array.
Reduce<TElement, TSum>Reduces the elements of the array to a single value.
RemoveAt<T>Removes the element at the specified index from the array.
Reverse<T>Reverses the order of the elements in the array.
Reversed<T>Reverses the order of the elements in the array.
Shuffle<T>Shuffles the array in place. The shuffle is done using the Fisher-Yates algorithm.
Slice<T>Returns a portion of the array containing a specified amount of elements.
Sort<T>Sorts the elements of the array.
Where<T>Filters the array to only contain elements that satisfy a predicate.
WrapIndexWraps an index to either end of the array if it is out of bounds.