public static IEnumerable<T> WhereNotNull<T>(this IEnumerable<T?> list) where T : struct
{
foreach (var item in list)
if (item != null)
yield return item.Value;
}
There are a couple of workarounds - you can use Nullable<T>, or this alternate syntax:
public static IEnumerable<T> WhereNotNull<T>(this IEnumerable<@`'?`<T>> list) where T : struct
This gives a syntax error:
There are a couple of workarounds - you can use
Nullable<T>
, or this alternate syntax: