Skip to content

Instantly share code, notes, and snippets.

@Spinks90
Last active May 25, 2020 22:15
Enumerable AsNotNull
public static IEnumerable<T> AsNotNull<T>(this IEnumerable<T> enumerable)
{
return enumerable ?? Enumerable.Empty<T>();
}
@Spinks90
Copy link
Author

Useful snippet to reduce lines of code without requiring to null check for loops.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment