fix: handle IEnumerable.Choose<TRefType> correctly (part 2)

This commit is contained in:
Kyle Ratti 2022-12-23 13:50:06 -05:00
parent eafcde134b
commit a0a8efb854
No known key found for this signature in database
GPG Key ID: 4D429B6287C68DD9

View File

@ -13,7 +13,7 @@ public static class EnumerableExtensions
!isConditionValid ? enumerable : enumerable.Where(pred); !isConditionValid ? enumerable : enumerable.Where(pred);
public static IEnumerable<TOutput> Choose<TInput, TOutput>(this IEnumerable<TInput> enumerable, Func<TInput, TOutput?> mapper) public static IEnumerable<TOutput> Choose<TInput, TOutput>(this IEnumerable<TInput> enumerable, Func<TInput, TOutput?> mapper)
where TInput : class? => where TOutput : class? =>
enumerable enumerable
.Select(mapper) .Select(mapper)
.Where(x => x is not null) .Where(x => x is not null)