You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Connected.Framework/Connected.Expressions/Translation/Grouping.cs

28 lines
551 B

2 years ago
using System.Collections;
namespace Connected.Expressions.Translation;
internal sealed class Grouping<TKey, TElement> : IGrouping<TKey, TElement>
{
public Grouping(TKey key, IEnumerable<TElement> group)
{
Key = key;
Group = group;
}
public TKey Key { get; }
private IEnumerable<TElement> Group { get; set; }
public IEnumerator<TElement> GetEnumerator()
{
if (!(Group is List<TElement>))
Group = Group.ToList();
return Group.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return Group.GetEnumerator();
}
}