mirror of
https://github.com/AssetRipper/AssetRipper.git
synced 2025-12-11 20:15:29 +01:00
29 lines
566 B
C#
29 lines
566 B
C#
namespace AssetRipper.SourceGenerated.Extensions
|
|
{
|
|
public static class EnumerableExtensions
|
|
{
|
|
public static IEnumerable<T> WhereNotNull<T>(this IEnumerable<T?> enumerable) where T : notnull
|
|
{
|
|
foreach (T? item in enumerable)
|
|
{
|
|
if (item is not null)
|
|
{
|
|
yield return item;
|
|
}
|
|
}
|
|
}
|
|
|
|
public static IEnumerable<T> ThrowIfNull<T>(this IEnumerable<T?> enumerable) where T : notnull
|
|
{
|
|
foreach (T? item in enumerable)
|
|
{
|
|
if (item is null)
|
|
{
|
|
throw new NullReferenceException();
|
|
}
|
|
yield return item;
|
|
}
|
|
}
|
|
}
|
|
}
|