Skip to content

Hooks.Enumeration

Mariusz edited this page Feb 12, 2020 · 4 revisions

Hooks's Enumeration nested class contains all utility methods based around enumeration, lists and arrays.

Public Methods

T[] ArrayMerger<T>(T[], T[])

Merges two arrays together.

bool EnumerableContains<T>(IEnumerable<T>, IEnumerable<T>)

Checks if the first IEnumerable given contains any element of the second.

T Find<T>(T[], Predicate<T>)

Simplified version of Array.Find.

int FindIndex<T>(T[], Predicate<T>)

Simplified version of Array.FindIndex.

void ForEach<T>(T[], Action<T>)

Itterates through each element in an array and performs an action on it.

IEnumerable<T> InstantiateList<T>(IEnumerable<T>) where T : UnityEngine.Object

Returns a list of object that were passed through UnityObject.Instantiate.

bool IsEmpty<T>(IEnumerable<T>)

Returns true if all elements are null or if the IEnumerable itself is null.

bool ListContainsType<T>(List<T>, Type)

Returns true if the list contains a type. (Useful to see if a list of base classes contains an inherited class)

void RemoveDefault<T>(IEnumerable<T>)

Removes all default elements inside a collection.

void RemoveNull<T>(IEnumerable<T>)

Removes all null elements inside a collection.

IEnumerable<T> ToGeneric<T>(IEnumerable)

Converts an IEnumerable into a generic IEnumerable<T>.

List<T> ToGenericList<T>(IList, bool)

Converts a generic IList into a List.