Created
August 16, 2011 15:59
-
-
Save jrwren/1149419 to your computer and use it in GitHub Desktop.
I just want to write pretty code... NullToEmpty
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> NullToEmpty<T>(this IEnumerable<T> source) | |
{ | |
if (source==null) | |
return new T[]{}; | |
return source; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment