How to let compiler know that List is not null?
Hi community!
I have the following extension method:, which checks if the source is not null and if it contains any elements:
I'd like to inform the compiler that, when returning true, the source is not null. Is this possible to achieve with C#?
Thank you!
I have the following extension method:, which checks if the source is not null and if it contains any elements:
public static bool SafeAny<T>(this IEnumerable<T> source) => source != null && source.Any();I'd like to inform the compiler that, when returning true, the source is not null. Is this possible to achieve with C#?
Thank you!
