Last active
May 25, 2020 22:15
Enumerable AsNotNull
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IEnumerable<T> AsNotNull<T>(this IEnumerable<T> enumerable) | |
{ | |
return enumerable ?? Enumerable.Empty<T>(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Useful snippet to reduce lines of code without requiring to null check for loops.