Speaking of Array.Empty<T>(), there’s a related change in .NET Framework 4.6 and .NET Core: empty arrays now return a single cached instance of IEnumerator<T> when GetEnumerator() is called.

Previously, calls to GetEnumerator() on an empty array would always return a new enumerator instance. That’s no longer the case!

Questions or comments? I'm @justinvp on Twitter.

Archive