Skip to content

Instantly share code, notes, and snippets.

@MichalBrylka
Created May 19, 2020 09:26
Show Gist options
  • Save MichalBrylka/288196a20bcafddf29ed933145c7388a to your computer and use it in GitHub Desktop.
Save MichalBrylka/288196a20bcafddf29ed933145c7388a to your computer and use it in GitHub Desktop.
// Do not replace the array allocation with Array.Empty. We don't want to have the overhead of
// instantiating another generic type in addition to ArraySegment<T> for new type parameters.
public static ArraySegment<T> Empty { get; } = new ArraySegment<T>(new T[0]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment