.NET Framework - System.Linq.EmptyEnumerable<TElement> 类

创建时间:
2018-09-30 11:33
最近更新:
2018-09-30 11:33

Source Code of System.Linq.EmptyEnumerable<TElement> from JetBrains dotPeek 1.0 at 2018-09-30

Complete Copy:

// Type: System.Linq.EmptyEnumerable`1
// Assembly: System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// Assembly location: C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Core.dll

namespace System.Linq
{
  internal class EmptyEnumerable<TElement>
  {
    public static readonly TElement[] Instance = new TElement[0];

    static EmptyEnumerable()
    {
    }
  }
}

All Usages

2018-09-30 在 dotPeek 只找到两处调用:

namespace System.Linq
{
    [__DynamicallyInvokable]
    public static class Enumerable
    {
        [__DynamicallyInvokable]
        public static IEnumerable<TResult> Empty<TResult>()
        {
            return EmptyEnumerable<TResult>.Instance;
        }
    }
}
namespace System.Linq
{
    [__DynamicallyInvokable]
    public class Lookup<TKey, TElement> : IEnumerable<IGrouping<TKey, TElement>>, IEnumerable, ILookup<TKey, TElement>
    {
        [__DynamicallyInvokable]
        public IEnumerable<TElement> this[TKey key]
        {
            [__DynamicallyInvokable] get
            {
                return (IEnumerable<TElement>) this.GetGrouping(key, false) ?? (IEnumerable<TElement>) EmptyEnumerable<TElement>.Instance;
            }
        }
    }
}