Skip to content

Instantly share code, notes, and snippets.

@AndyPook
Last active March 9, 2016 14:01
Show Gist options
  • Save AndyPook/5a0089b344441aebcb3c to your computer and use it in GitHub Desktop.
Save AndyPook/5a0089b344441aebcb3c to your computer and use it in GitHub Desktop.
Equivalent of Enumerable.Empty<T> but returns an ICollection<T> (an empty array)
public static class Arrays
{
public static T[] Empty<T>() { return EmptyArray<T>.Instance; }
}
public static class EmptyArray<T>
{
public static readonly T[] Instance = new T[0];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment