Skip to content

Instantly share code, notes, and snippets.

@FloWi
Created March 8, 2012 10:47
Show Gist options
  • Save FloWi/2000368 to your computer and use it in GitHub Desktop.
Save FloWi/2000368 to your computer and use it in GitHub Desktop.
IEnumerable<T> extension
public static class IEnumerableExtensions
{
public static IEnumerable<T> OrEmpty<T>(this IEnumerable<T> t)
{
return t ?? Enumerable.Empty<T>();
}
public static IEnumerable<T> OrEmpty_WontCompile<T>(this T t)
{
return t ?? Enumerable.Empty<T>();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment