Using Linq’s Where/Select to filter out null and convert the type to non-nullable cannot be made into an extension method
You have to update your extension method to the following public static IEnumerable<T> NotNull<T>(this IEnumerable<T?> enumerable) where T : class { return enumerable.Where(e => e != null).Select(e => e!); } The point here is that you are converting the IEnumerable of nullable references to not nullable ones, therefore you’ll have to use IEnumerable<T?>. where T … Read more