IAsyncGrouping.cs 1.0 KB

12345678910111213141516171819
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT License.
  3. // See the LICENSE file in the project root for more information.
  4. using System.Collections.Generic;
  5. namespace System.Linq
  6. {
  7. // System.Linq.AsyncEnumerable defines no equivalent for this, because it uses an IAsyncEnumerable<IGrouping<TKey, TElement>>
  8. // In theory that is less good because it allows await only at the per-group level. In practice System.Linq.Async never
  9. // made use of that because the only operators that returned an IAsyncGrouping<TKey, TElement> fully enumerated the source
  10. // on the very first MoveNextAsync, meaning that by the time you got to inspect a group, its contents were available
  11. // immediately. So this interface merely forced code to use await foreach unnecessarily. We retain this for binary
  12. // compatibility, but it serves no long term purpose.
  13. public interface IAsyncGrouping<out TKey, out TElement> : IAsyncEnumerable<TElement>
  14. {
  15. TKey Key { get; }
  16. }
  17. }