-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Labels
Description
This gives a syntax error:
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