diff options
author | Jb Evain <jbevain@gmail.com> | 2008-05-02 00:45:19 +0400 |
---|---|---|
committer | Jb Evain <jbevain@gmail.com> | 2008-05-02 00:45:19 +0400 |
commit | fedf99df53ff0de3ea01e541ea3eb048ff58e80d (patch) | |
tree | 6b59e64712f872c6e76bda10067524cb089fe33c /mcs/class/System.Core/System.Linq/Lookup.cs | |
parent | f2ab023d8d9b656b27c5d51afd7f4e7e2b4b112c (diff) |
clean this mess once in for all
svn path=/trunk/mcs/; revision=102300
Diffstat (limited to 'mcs/class/System.Core/System.Linq/Lookup.cs')
-rw-r--r-- | mcs/class/System.Core/System.Linq/Lookup.cs | 85 |
1 files changed, 43 insertions, 42 deletions
diff --git a/mcs/class/System.Core/System.Linq/Lookup.cs b/mcs/class/System.Core/System.Linq/Lookup.cs index 75ef6de4d82..b3e13a6149e 100644 --- a/mcs/class/System.Core/System.Linq/Lookup.cs +++ b/mcs/class/System.Core/System.Linq/Lookup.cs @@ -32,46 +32,47 @@ using System; using System.Collections; using System.Collections.Generic; -namespace System.Linq -{ - public class Lookup<TKey, TElement> : IEnumerable<IGrouping<TKey, TElement>>, ILookup<TKey, TElement> - { - Dictionary<TKey, IGrouping<TKey, TElement>> groups; - - internal Lookup (Dictionary<TKey, List<TElement>> groups) - { - this.groups = new Dictionary<TKey, IGrouping<TKey, TElement>> (); - foreach (KeyValuePair<TKey, List<TElement>> group in groups) - this.groups.Add (group.Key, new Grouping<TKey, TElement>(group.Key, group.Value)); - } - - public IEnumerable<TResult> ApplyResultSelector<TResult>(Func<TKey, IEnumerable <TElement>, TResult> selector) - { - throw new NotImplementedException (); - } - - public int Count { - get { return groups.Count; } - } - - public bool Contains (TKey key) - { - return groups.ContainsKey (key); - } - - public IEnumerable<TElement> this [TKey key] - { - get { return groups[key]; } - } - - public IEnumerator<IGrouping<TKey, TElement>> GetEnumerator () - { - return groups.Values.GetEnumerator (); - } - - IEnumerator IEnumerable.GetEnumerator () - { - return groups.Values.GetEnumerator (); - } - } +namespace System.Linq { + + class Lookup<TKey, TElement> : IEnumerable<IGrouping<TKey, TElement>>, ILookup<TKey, TElement> { + + Dictionary<TKey, IGrouping<TKey, TElement>> groups; + + internal Lookup (Dictionary<TKey, List<TElement>> groups) + { + this.groups = new Dictionary<TKey, IGrouping<TKey, TElement>> (); + foreach (KeyValuePair<TKey, List<TElement>> group in groups) + this.groups.Add (group.Key, new Grouping<TKey, TElement> (group.Key, group.Value)); + } + + public IEnumerable<TResult> ApplyResultSelector<TResult> (Func<TKey, IEnumerable<TElement>, TResult> selector) + { + throw new NotImplementedException (); + } + + public int Count + { + get { return groups.Count; } + } + + public bool Contains (TKey key) + { + return groups.ContainsKey (key); + } + + public IEnumerable<TElement> this [TKey key] + { + get { return groups [key]; } + } + + public IEnumerator<IGrouping<TKey, TElement>> GetEnumerator () + { + return groups.Values.GetEnumerator (); + } + + IEnumerator IEnumerable.GetEnumerator () + { + return groups.Values.GetEnumerator (); + } + } } |