Skip to content

Instantly share code, notes, and snippets.

@jrwren
Created August 16, 2011 15:59
Show Gist options
  • Save jrwren/1149419 to your computer and use it in GitHub Desktop.
Save jrwren/1149419 to your computer and use it in GitHub Desktop.
I just want to write pretty code... NullToEmpty
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