Class EnumerableExtensions
Extensions for IEnumerable<T> that don't currently exist in System.Linq
.
Inherited Members
Namespace: IPA.Utilities
Assembly: IPA.Loader.dll
Syntax
public static class EnumerableExtensions
Methods
| Improve this Doc View SourceAppend<T>(IEnumerable<T>, T)
Adds a value to the end of the sequence.
Declaration
public static IEnumerable<T> Append<T>(this IEnumerable<T> seq, T app)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | seq | a sequence of values |
T | app | the value to append to |
Returns
Type | Description |
---|---|
IEnumerable<T> | a new sequence ending with |
Type Parameters
Name | Description |
---|---|
T | the type of the elements of |
NonNull<T>(IEnumerable<T>)
LINQ-style extension method that filters null elements out of an enumeration.
Declaration
public static IEnumerable<T> NonNull<T>(this IEnumerable<T> self)
where T : class
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | self | the enumeration to filter |
Returns
Type | Description |
---|---|
IEnumerable<T> | a filtered enumerable |
Type Parameters
Name | Description |
---|---|
T | the type of the enumeration |
NonNull<T>(IEnumerable<Nullable<T>>)
LINQ-style extension method that filters null elements from an enumeration of nullable types.
Declaration
public static IEnumerable<T> NonNull<T>(this IEnumerable<T?> self)
where T : struct
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Nullable<T>> | self | the enumeration to filter |
Returns
Type | Description |
---|---|
IEnumerable<T> | a filtered enumerable |
Type Parameters
Name | Description |
---|---|
T | the underlying type of the nullable enumeration |
NonNull<T, U>(IEnumerable<T>, Func<T, U>)
LINQ-style extension method that filters null elements out of an enumeration based on a converter.
Declaration
public static IEnumerable<T> NonNull<T, U>(this IEnumerable<T> self, Func<T, U> pred)
where U : class
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | self | the enumeration to filter |
Func<T, U> | pred | the predicate to select for filtering |
Returns
Type | Description |
---|---|
IEnumerable<T> | a filtered enumerable |
Type Parameters
Name | Description |
---|---|
T | the type of the enumeration |
U | the type to compare to null |
NonNull<T, U>(IEnumerable<T>, Func<T, Nullable<U>>)
LINQ-style extension method that filters null elements out of an enumeration based on a converter to a nullable type.
Declaration
public static IEnumerable<T> NonNull<T, U>(this IEnumerable<T> self, Func<T, U?> pred)
where U : struct
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | self | the enumeration to filter |
Func<T, Nullable<U>> | pred | the predicate to select for filtering |
Returns
Type | Description |
---|---|
IEnumerable<T> | a filtered enumerable |
Type Parameters
Name | Description |
---|---|
T | the type of the enumeration |
U | the type of the predicate's resulting nullable |
Prepend<T>(IEnumerable<T>, T)
Adds a value to the beginning of the sequence.
Declaration
public static IEnumerable<T> Prepend<T>(this IEnumerable<T> seq, T prep)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | seq | a sequence of values |
T | prep | the value to prepend to |
Returns
Type | Description |
---|---|
IEnumerable<T> | a new sequence beginning with |
Type Parameters
Name | Description |
---|---|
T | the type of the elements of |