| 1 |
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. |
| 2 |
using System; |
| 3 |
using System.Collections.Generic; |
| 4 |
using System.Linq; |
| 5 |
|
| 6 |
namespace System.Linq |
| 7 |
{ |
| 8 |
class EnumerableGrouping<TKey, TElement> : IGrouping<TKey, TElement> |
| 9 |
{ |
| 10 |
List<TElement> elements = new List<TElement>(); |
| 11 |
|
| 12 |
public EnumerableGrouping(TKey key) |
| 13 |
{ |
| 14 |
Key = key; |
| 15 |
} |
| 16 |
|
| 17 |
public void Add(TElement element) |
| 18 |
{ |
| 19 |
elements.Add(element); |
| 20 |
} |
| 21 |
|
| 22 |
public TKey Key { get; private set; } |
| 23 |
|
| 24 |
public IEnumerator<TElement> GetEnumerator() |
| 25 |
{ |
| 26 |
return elements.GetEnumerator(); |
| 27 |
} |
| 28 |
|
| 29 |
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() |
| 30 |
{ |
| 31 |
return this.GetEnumerator(); |
| 32 |
} |
| 33 |
} |
| 34 |
} |