Table of Contents

Class EnumerableExtensions

Namespace
Xunit.Internal

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

source IEnumerable<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

source IEnumerable<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

source IEnumerable<T>

Returns

IReadOnlyCollection<T>

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

source IEnumerable<T>

Returns

IReadOnlyList<T>

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

source IEnumerable<T>
callback Action<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

source IEnumerable<string>

Returns

IEnumerable<string>

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

source IEnumerable<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

source IEnumerable<T>

Returns

IEnumerable<T>

Type Parameters

T