Author: miguel
Date: 2008-02-09 22:54:55 -0500 (Sat, 09 Feb 2008)
New Revision: 95356
Modified:
trunk/mcs/class/System.Core/System.Linq/ChangeLog
trunk/mcs/class/System.Core/System.Linq/Enumerable.cs
Log:
2008-02-09 Miguel de Icaza <[EMAIL PROTECTED]>
* Enumerable.cs (ToDictionary): Implement this overload.
Modified: trunk/mcs/class/System.Core/System.Linq/ChangeLog
===================================================================
--- trunk/mcs/class/System.Core/System.Linq/ChangeLog 2008-02-10 02:59:06 UTC
(rev 95355)
+++ trunk/mcs/class/System.Core/System.Linq/ChangeLog 2008-02-10 03:54:55 UTC
(rev 95356)
@@ -1,3 +1,7 @@
+2008-02-09 Miguel de Icaza <[EMAIL PROTECTED]>
+
+ * Enumerable.cs (ToDictionary): Implement this overload.
+
2008-02-01 Jb Evain <[EMAIL PROTECTED]>
* Queryable.cs, Check.cs: integrate GHOP work from
Modified: trunk/mcs/class/System.Core/System.Linq/Enumerable.cs
===================================================================
--- trunk/mcs/class/System.Core/System.Linq/Enumerable.cs 2008-02-10
02:59:06 UTC (rev 95355)
+++ trunk/mcs/class/System.Core/System.Linq/Enumerable.cs 2008-02-10
03:54:55 UTC (rev 95356)
@@ -2314,9 +2314,16 @@
public static Dictionary<TKey, TSource> ToDictionary<TSource,
TKey> (this IEnumerable<TSource> source,
Func<TSource, TKey> keySelector,
IEqualityComparer<TKey> comparer)
{
- throw new NotImplementedException ();
- // FIXME: compiler issue
- //return ToDictionary (source, keySelector, (a) => a,
comparer);
+ Check.SourceAndKeySelector (source, keySelector);
+
+ if (comparer == null)
+ comparer = EqualityComparer<TKey>.Default;
+
+ var dict = new Dictionary<TKey, TSource> (comparer);
+ foreach (var e in source)
+ dict.Add (keySelector (e), e);
+
+ return dict;
}
#endregion
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches