ListExtensions

Static Class in Zigurous.Architecture

Declaration

public static class ListExtensions

Description

Extension methods for lists.

Extension Methods

Add<T>Adds a specified amount of a given value to the list.
CombinedWith<T>Combines the list with another.
Contains<T>Checks if the list contains an item that satisfies a predicate.
ContainsAll<T>Checks if the list contains all items that satisfy a predicate.
ItemAt<T>Returns the item at the specified index.
Filter<T>Filters the list to only contain items that satisfy a predicate.
First<T>Returns the first item in the list.
FirstNonNull<T>Returns the first non-null item in the list.
For<T>Invokes an action for each item in the list. The item and index are passed as parameters.
IndexOf<T>Returns the index of the first item in the list that satisfies the predicate.
IsEmpty<T>Checks if the list is empty.
IsNotEmpty<T>Checks if the list is not empty.
IsInBounds<T>Checks if the specified index is within the bounds of the list.
IsNotInBounds<T>Checks if the specified index is out of bounds of the list.
Join<T>Joins the items of the list into a string with a delimiter.
Last<T>Returns the last item in the list.
LastNonNull<T>Returns the last non-null item in the list.
Map<TInput, TOutput>Maps the items of the list to a new list using a converter function.
NonNull<T>Filters out all null items from the list.
Random<T>Returns a random item from the list.
Reduce<TItem, TSum>Reduces the items of the list to a single value.
RemoveFirst<T>Removes the first item in the list.
RemoveLast<T>Removes the last item in the list.
Reversed<T>Reverses the order of the items in the list.
Shuffle<T>Shuffles the list in place. The shuffle is done using the Fisher-Yates algorithm.
Where<T>Filters the list to only contain items that satisfy a predicate.
WrapIndex<T>Wraps an index to either end of the list if it is out of bounds.