Author: kostat
Date: 2007-01-18 07:41:05 -0500 (Thu, 18 Jan 2007)
New Revision: 71254
Modified:
trunk/mcs/class/System/System.Collections.Specialized/ChangeLog
trunk/mcs/class/System/System.Collections.Specialized/OrderedDictionary.cs
trunk/mcs/class/System/Test/System.Collections.Specialized/OrderedDictionaryTest.cs
Log:
use IEqualityComparer for key comparison
Modified: trunk/mcs/class/System/System.Collections.Specialized/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.Collections.Specialized/ChangeLog
2007-01-18 12:03:06 UTC (rev 71253)
+++ trunk/mcs/class/System/System.Collections.Specialized/ChangeLog
2007-01-18 12:41:05 UTC (rev 71254)
@@ -1,3 +1,7 @@
+2007-01-18 Konstantin Triger <[EMAIL PROTECTED]>
+
+ * OrderedDictionary.cs: use IEqualityComparer for key comparison.
+
2006-10-03 Andrew Skiba <[EMAIL PROTECTED]>
* ListDictionary.cs: remove unnecessary out parameter
Modified:
trunk/mcs/class/System/System.Collections.Specialized/OrderedDictionary.cs
===================================================================
--- trunk/mcs/class/System/System.Collections.Specialized/OrderedDictionary.cs
2007-01-18 12:03:06 UTC (rev 71253)
+++ trunk/mcs/class/System/System.Collections.Specialized/OrderedDictionary.cs
2007-01-18 12:41:05 UTC (rev 71254)
@@ -238,7 +238,7 @@
{
for (int n=0; n<list.Count; n++) {
DictionaryEntry de = (DictionaryEntry) list [n];
- if (de.Key.Equals (key))
+ if (comparer != null ? comparer.Equals(de.Key,
key) : de.Key.Equals(key))
return n;
}
return -1;
Modified:
trunk/mcs/class/System/Test/System.Collections.Specialized/OrderedDictionaryTest.cs
===================================================================
---
trunk/mcs/class/System/Test/System.Collections.Specialized/OrderedDictionaryTest.cs
2007-01-18 12:03:06 UTC (rev 71253)
+++
trunk/mcs/class/System/Test/System.Collections.Specialized/OrderedDictionaryTest.cs
2007-01-18 12:41:05 UTC (rev 71254)
@@ -121,6 +121,15 @@
}
[Test]
+ public void Constructor_NoCase_IEqualityComparer ()
+ {
+ OrderedDictionary od = new OrderedDictionary
(StringComparer.InvariantCultureIgnoreCase);
+ od ["Original_PhotoID"] = null;
+ od ["original_PhotoID"] = 12;
+ Assert.AreEqual (1, od.Count);
+ }
+
+ [Test]
// [ExpectedException (typeof (ArgumentOutOfRangeException))]
public void Constructor_IntNegative_IEqualityComparer ()
{
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches