Class EnumerableExtensions
INTERNAL CLASS. DO NOT USE.
public static class EnumerableExtensions
- Inheritance
-
EnumerableExtensions
- Inherited Members
Methods
CastOrToArray<T>(IEnumerable<T>?)
Returns source as an array of T, using a cast when
available and ToArray<TSource>(IEnumerable<TSource>) when not.
public static T[]? CastOrToArray<T>(this IEnumerable<T>? source)
Parameters
sourceIEnumerable<T>
Returns
- T[]
Type Parameters
T
CastOrToList<T>(IEnumerable<T>?)
Returns source as a List<T>, using a cast when
available and ToList<TSource>(IEnumerable<TSource>) when not.
public static List<T>? CastOrToList<T>(this IEnumerable<T>? source)
Parameters
sourceIEnumerable<T>
Returns
- List<T>
Type Parameters
T
CastOrToReadOnlyCollection<T>(IEnumerable<T>?)
Returns source as an IReadOnlyCollection<T> of T,
using a cast when available and ToArray<TSource>(IEnumerable<TSource>) when not.
public static IReadOnlyCollection<T>? CastOrToReadOnlyCollection<T>(this IEnumerable<T>? source)
Parameters
sourceIEnumerable<T>
Returns
Type Parameters
T
CastOrToReadOnlyList<T>(IEnumerable<T>?)
Returns source as an IReadOnlyList<T> of T,
using a cast when available and ToArray<TSource>(IEnumerable<TSource>) when not.
public static IReadOnlyList<T>? CastOrToReadOnlyList<T>(this IEnumerable<T>? source)
Parameters
sourceIEnumerable<T>
Returns
Type Parameters
T
ForEach<T>(IEnumerable<T>, Action<T>)
Enumerates all values in a collection, calling the callback for each.
public static void ForEach<T>(this IEnumerable<T> source, Action<T> callback)
Parameters
sourceIEnumerable<T>callbackAction<T>
Type Parameters
T
WhereNotNullOrWhitespace(IEnumerable<string?>)
Returns source with all the null or whitespace-only strings removed.
public static IEnumerable<string> WhereNotNullOrWhitespace(this IEnumerable<string?> source)
Parameters
sourceIEnumerable<string>
Returns
WhereNotNull<T>(IEnumerable<T?>)
Returns source as an enumerable of T with
all the null items removed.
public static IEnumerable<T> WhereNotNull<T>(this IEnumerable<T?> source) where T : struct
Parameters
sourceIEnumerable<T?>
Returns
- IEnumerable<T>
Type Parameters
T
WhereNotNull<T>(IEnumerable<T?>)
Returns source as an enumerable of T with
all the null items removed.
public static IEnumerable<T> WhereNotNull<T>(this IEnumerable<T?> source) where T : class
Parameters
sourceIEnumerable<T>
Returns
- IEnumerable<T>
Type Parameters
T