dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dotgnu-pnet-commits] pnetlib ChangeLog System/Collections/Specialize...


From: Radek Polak
Subject: [dotgnu-pnet-commits] pnetlib ChangeLog System/Collections/Specialize...
Date: Sat, 07 Mar 2009 07:12:07 +0000

CVSROOT:        /sources/dotgnu-pnet
Module name:    pnetlib
Changes by:     Radek Polak <radekp>    09/03/07 07:12:07

Modified files:
        .              : ChangeLog 
        System/Collections/Specialized: ListDictionary.cs 

Log message:
        fix setter in list dictionary

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnetlib/ChangeLog?cvsroot=dotgnu-pnet&r1=1.2568&r2=1.2569
http://cvs.savannah.gnu.org/viewcvs/pnetlib/System/Collections/Specialized/ListDictionary.cs?cvsroot=dotgnu-pnet&r1=1.1&r2=1.2

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/dotgnu-pnet/pnetlib/ChangeLog,v
retrieving revision 1.2568
retrieving revision 1.2569
diff -u -b -r1.2568 -r1.2569
--- ChangeLog   2 Mar 2009 08:46:11 -0000       1.2568
+++ ChangeLog   7 Mar 2009 07:12:07 -0000       1.2569
@@ -1,7 +1,12 @@
+2009-03-01  Radek Polak  <address@hidden>
+
+       * System/Collections/Specialized/ListDictionary.cs: Fix setter for list
+       dictionary.
+
 2009-03-02  Heiko Weiss <address@hidden>
        
-       * System.Windows.Forms/ScrollableControl.cs: fixed autoscroll if 
controls are
-       removed or added.
+       * System.Windows.Forms/ScrollableControl.cs: fixed autoscroll if 
controls
+       are removed or added.
 
 2009-03-01  Radek Polak  <address@hidden>
 

Index: System/Collections/Specialized/ListDictionary.cs
===================================================================
RCS file: 
/sources/dotgnu-pnet/pnetlib/System/Collections/Specialized/ListDictionary.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- System/Collections/Specialized/ListDictionary.cs    15 Nov 2002 04:33:04 
-0000      1.1
+++ System/Collections/Specialized/ListDictionary.cs    7 Mar 2009 07:12:07 
-0000       1.2
@@ -52,8 +52,8 @@
                                this.generation = 0;
                        }
 
-       // Implement the IDictionary interface.
-       public void Add(Object key, Object value)
+       // Common function for add and set operations.
+       private void SetOrAdd(Object key, Object value, bool set)
                        {
                                if(key == null)
                                {
@@ -65,6 +65,10 @@
                                {
                                        if(comparer.Compare(current.key, key) 
== 0)
                                        {
+                                               if(set)
+                                               {
+                                                       return;
+                                               }
                                                throw new 
ArgumentException(S._("Arg_ExistingEntry"));
                                        }
                                        prev = current;
@@ -81,6 +85,13 @@
                                ++count;
                                ++generation;
                        }
+
+       // Implement the IDictionary interface.
+       public void Add(Object key, Object value)
+                       {
+                               SetOrAdd(key, value, false);
+                       }
+
        public void Clear()
                        {
                                list = null;
@@ -159,7 +170,7 @@
                                }
                                set
                                {
-                                       Add(key, value);
+                                       SetOrAdd(key, value, true);
                                }
                        }
        public ICollection Keys




reply via email to

[Prev in Thread] Current Thread [Next in Thread]