Skip to content

Instantly share code, notes, and snippets.

@Mike-E-angelo
Last active September 8, 2018 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mike-E-angelo/e4bdafb8751495c5d565037036bba4e8 to your computer and use it in GitHub Desktop.
Save Mike-E-angelo/e4bdafb8751495c5d565037036bba4e8 to your computer and use it in GitHub Desktop.
Hashing out Empty
// Re: https://medium.com/@antao.almada/enumeration-in-net-iii-enumerable-empty-t-1bfcd53739a7
// Decompiled with JetBrains decompiler
// Type: System.Linq.Enumerable
// Assembly: System.Linq, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// MVID: 27FAC526-A042-4B73-AEC3-616A6586AC97
// Assembly location: c:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.3\System.Linq.dll
namespace System.Linq
{
public static class Enumerable
{
public static IEnumerable<TResult> Empty<TResult>()
{
return (IEnumerable<TResult>) Array.Empty<TResult>();
}
}
}
// ...
// Decompiled with JetBrains decompiler
// Type: System.Array
// Assembly: System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
// MVID: 7540A5DA-343D-4E6A-AC2A-6190E339F993
// Assembly location: c:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.3\System.Private.CoreLib.dll
using Internal.Runtime.CompilerServices;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.CompilerServices;
namespace System
{
[TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
[Serializable]
public abstract class Array : ICloneable, IList, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable
{
public static T[] Empty<T>()
{
return Array.EmptyArray<T>.Value;
}
private static class EmptyArray<T>
{
internal static readonly T[] Value = new T[0];
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment