22using System . Collections ;
33using System . Collections . Generic ;
44using System . Collections . ObjectModel ;
5+ using System . Diagnostics ;
56using System . Linq ;
67
78namespace Berrysoft . Data
@@ -68,9 +69,11 @@ internal interface ICountableGrouping<TKey, TElement> : IGrouping<TKey, TElement
6869 /// <typeparam name="TKey">The type of the keys in the <see cref="Lookup{TKey, TElement}"/>.</typeparam>
6970 /// <typeparam name="TElement">The type of the elements of each value in the <see cref="Lookup{TKey, TElement}"/>.</typeparam>
7071 [ Serializable ]
71- public class Lookup < TKey , TElement > : IMutableLookup < TKey , TElement > , IEnumerable < KeyValuePair < TKey , TElement > > , IEnumerable < ICountableGrouping < TKey , TElement > >
72+ [ DebuggerTypeProxy ( typeof ( LookupDebugView < , > ) ) ]
73+ [ DebuggerDisplay ( "Count = {Count}" ) ]
74+ public class Lookup < TKey , TElement > : IMutableLookup < TKey , TElement > , IEnumerable < KeyValuePair < TKey , TElement > > , IEnumerable < Lookup < TKey , TElement > . Grouping >
7275 {
73- private Dictionary < TKey , Grouping > dic ;
76+ private readonly Dictionary < TKey , Grouping > dic ;
7477 /// <summary>
7578 /// Initialize a new instance of <see cref="Lookup{TKey, TElement}"/> class.
7679 /// </summary>
@@ -255,7 +258,7 @@ public IEnumerator<KeyValuePair<TKey, TElement>> GetEnumerator()
255258 /// Returns a generic enumerator that iterates through the <see cref="Lookup{TKey, TElement}"/>.
256259 /// </summary>
257260 /// <returns>An enumerator for the <see cref="Lookup{TKey, TElement}"/>.</returns>
258- IEnumerator < ICountableGrouping < TKey , TElement > > IEnumerable < ICountableGrouping < TKey , TElement > > . GetEnumerator ( ) => GetEnumeratorInternal ( ) ;
261+ IEnumerator < Grouping > IEnumerable < Grouping > . GetEnumerator ( ) => GetEnumeratorInternal ( ) ;
259262 /// <summary>
260263 /// Returns an enumerator that iterates through the <see cref="Lookup{TKey, TElement}"/>. This class cannot be inherited.
261264 /// </summary>
@@ -265,7 +268,7 @@ public IEnumerator<KeyValuePair<TKey, TElement>> GetEnumerator()
265268 /// Returns a generic enumerator that iterates through the <see cref="Lookup{TKey, TElement}"/>.
266269 /// </summary>
267270 /// <returns>An enumerator for the <see cref="Lookup{TKey, TElement}"/>.</returns>
268- private IEnumerator < Grouping > GetEnumeratorInternal ( )
271+ internal IEnumerator < Grouping > GetEnumeratorInternal ( )
269272 {
270273 foreach ( var item in dic )
271274 {
@@ -275,7 +278,7 @@ private IEnumerator<Grouping> GetEnumeratorInternal()
275278 /// <summary>
276279 /// Represents a key and a sequence of elements.
277280 /// </summary>
278- private class Grouping : ICountableGrouping < TKey , TElement > , ICollection < TElement >
281+ internal class Grouping : ICountableGrouping < TKey , TElement > , ICollection < TElement >
279282 {
280283 private readonly TKey key ;
281284 private readonly Collection < TElement > collection ;
0 commit comments