Class CollectionExtensions
- Namespace
- HarmonyLib
- Assembly
- 0Harmony.dll
General extensions for collections
public static class CollectionExtensions
- Inheritance
-
objectCollectionExtensions
Methods
AddItem<T>(IEnumerable<T>, T)
A helper to add an item to a collection
public static IEnumerable<T> AddItem<T>(this IEnumerable<T> sequence, T item)
Parameters
sequenceIEnumerable<T>The collection
itemTThe item to add
Returns
- IEnumerable<T>
The collection containing the item
Type Parameters
TThe inner type of the collection
AddRangeToArray<T>(T[], T[])
A helper to add items to an array
public static T[] AddRangeToArray<T>(this T[] sequence, T[] items)
Parameters
sequenceT[]The array
itemsT[]The items to add
Returns
- T[]
The array containing the items
Type Parameters
TThe inner type of the collection
AddToArray<T>(T[], T)
A helper to add an item to an array
public static T[] AddToArray<T>(this T[] sequence, T item)
Parameters
sequenceT[]The array
itemTThe item to add
Returns
- T[]
The array containing the item
Type Parameters
TThe inner type of the collection
DoIf<T>(IEnumerable<T>, Func<T, bool>, Action<T>)
A simple way to execute code for elements in a collection matching a condition
public static void DoIf<T>(this IEnumerable<T> sequence, Func<T, bool> condition, Action<T> action)
Parameters
sequenceIEnumerable<T>The collection
conditionFunc<T, bool>The predicate
actionAction<T>The action to execute
Type Parameters
TThe inner type of the collection
Do<T>(IEnumerable<T>, Action<T>)
A simple way to execute code for every element in a collection
public static void Do<T>(this IEnumerable<T> sequence, Action<T> action)
Parameters
sequenceIEnumerable<T>The collection
actionAction<T>The action to execute
Type Parameters
TThe inner type of the collection