Skip to content

Instantly share code, notes, and snippets.

@Mike-E-angelo

Mike-E-angelo/Empty

Last active Sep 8, 2018
Embed
What would you like to do?
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