Author: roeie
Date: 2007-05-28 00:46:50 -0400 (Mon, 28 May 2007)
New Revision: 78026

Modified:
   
branches/mainsoft/gh20/mcs/class/System/System.Collections.Specialized/NameObjectCollectionBase.cs
   
branches/mainsoft/gh20/mcs/class/System/System.Collections.Specialized/NameValueCollection.cs
   
branches/mainsoft/gh20/mcs/class/System/Test/System.Collections.Specialized/NameValueCollectionTest.cs
Log:


Modified: 
branches/mainsoft/gh20/mcs/class/System/System.Collections.Specialized/NameObjectCollectionBase.cs
===================================================================
--- 
branches/mainsoft/gh20/mcs/class/System/System.Collections.Specialized/NameObjectCollectionBase.cs
  2007-05-28 04:33:25 UTC (rev 78025)
+++ 
branches/mainsoft/gh20/mcs/class/System/System.Collections.Specialized/NameObjectCollectionBase.cs
  2007-05-28 04:46:50 UTC (rev 78026)
@@ -211,25 +211,25 @@
                        Init();
                }
 
-#if NET_2_0
-               protected NameObjectCollectionBase (IEqualityComparer 
equalityComparer)
+               internal NameObjectCollectionBase (IEqualityComparer 
equalityComparer, IComparer comparer, IHashCodeProvider hcp)
                {
+                       equality_comparer = equalityComparer;
+                       m_comparer = comparer;
+                       m_hashprovider = hcp;
                        m_readonly = false;
-                       equality_comparer = equalityComparer;
                        m_defCapacity = 0;
-                       Init();
+                       Init ();
                }
 
+#if NET_2_0
+               protected NameObjectCollectionBase (IEqualityComparer 
equalityComparer) : this( (equalityComparer == null ? 
StringComparer.InvariantCultureIgnoreCase : equalityComparer), null, null)
+               {                       
+               }               
+
                [Obsolete ("Use NameObjectCollectionBase(IEqualityComparer)")]
 #endif
-               protected NameObjectCollectionBase( IHashCodeProvider 
hashProvider, IComparer comparer )
-               {
-                       m_readonly = false;
-                       
-                       m_hashprovider = hashProvider;
-                       m_comparer = comparer;
-                       m_defCapacity = 0;
-                       Init();
+               protected NameObjectCollectionBase( IHashCodeProvider 
hashProvider, IComparer comparer ) : this(null, comparer, hashProvider)
+               {                       
                }
 
                protected NameObjectCollectionBase (SerializationInfo info, 
StreamingContext context)
@@ -241,7 +241,7 @@
                protected NameObjectCollectionBase (int capacity, 
IEqualityComparer equalityComparer)
                {
                        m_readonly = false;
-                       equality_comparer = equalityComparer;
+                       equality_comparer = (equalityComparer == null ? 
StringComparer.InvariantCultureIgnoreCase : equalityComparer);
                        m_defCapacity = capacity;
                        Init();
                }

Modified: 
branches/mainsoft/gh20/mcs/class/System/System.Collections.Specialized/NameValueCollection.cs
===================================================================
--- 
branches/mainsoft/gh20/mcs/class/System/System.Collections.Specialized/NameValueCollection.cs
       2007-05-28 04:33:25 UTC (rev 78025)
+++ 
branches/mainsoft/gh20/mcs/class/System/System.Collections.Specialized/NameValueCollection.cs
       2007-05-28 04:46:50 UTC (rev 78026)
@@ -50,8 +50,9 @@
                {
                }
 
-               public NameValueCollection (NameValueCollection col ) : base 
((col == null) ? null : col.HashCodeProvider,
-                                                                            
(col == null) ? null : col.Comparer)
+               public NameValueCollection (NameValueCollection col) : base (( 
col == null ) ? null : col.EqualityComparer ,
+                                                                               
                                                (col == null) ? null : 
col.Comparer, 
+                                                                               
                                                (col == null) ? null : 
col.HashCodeProvider)
                {
                        if (col==null)
 #if NET_2_0

Modified: 
branches/mainsoft/gh20/mcs/class/System/Test/System.Collections.Specialized/NameValueCollectionTest.cs
===================================================================
--- 
branches/mainsoft/gh20/mcs/class/System/Test/System.Collections.Specialized/NameValueCollectionTest.cs
      2007-05-28 04:33:25 UTC (rev 78025)
+++ 
branches/mainsoft/gh20/mcs/class/System/Test/System.Collections.Specialized/NameValueCollectionTest.cs
      2007-05-28 04:46:50 UTC (rev 78026)
@@ -345,7 +345,27 @@
                public void Constructor_IntNegative_IEqualityComparer ()
                {
                        new NameValueCollection (-1, new EqualityComparer ());
+               }
+
+               [Test]
+               public void Constructor_IEqualityComparer_Null ()
+               {
+                       NameValueCollection c1 = new NameValueCollection 
((IEqualityComparer)null);
+                       c1.Add ("key", "value");
+                       AssertEquals ("Constructor_IEqualityComparer_Null", 
c1.Get ("KEY"), "value");
+                       c1.Remove ("key");
+               }
+
+               [Test]
+               public void Constructor_NameValueCollection ()
+               {
+                       NameValueCollection c1 = new NameValueCollection 
(StringComparer.InvariantCultureIgnoreCase);
+                       c1.Add ("key", "value");
+                       NameValueCollection c2 = new NameValueCollection (c1);
+                       AssertEquals ("Constructor_NameValueCollection", c2.Get 
("KEY"), "value");
+                       c2.Remove ("key");
                }
-#endif
+#endif
+                       
        }
 }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to