2024-07-28 12:00:26 +00:00
|
|
|
namespace PkmnLib.Static.Utils;
|
|
|
|
|
2024-08-10 07:44:46 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Extension methods for <see cref="IEnumerable{T}"/>.
|
|
|
|
/// </summary>
|
2024-07-28 12:00:26 +00:00
|
|
|
public static class EnumerableHelpers
|
|
|
|
{
|
2024-08-10 07:44:46 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Returns all elements of the enumerable that are not null.
|
|
|
|
/// </summary>
|
2024-07-28 12:00:26 +00:00
|
|
|
public static IEnumerable<T> WhereNotNull<T>(this IEnumerable<T?> enumerable) where T : class =>
|
|
|
|
enumerable.Where(x => x is not null)!;
|
|
|
|
}
|