* ConfigurationElementCollection.cs
authorVladimir Krasnov <krasnov@mono-cvs.ximian.com>
Sun, 10 Dec 2006 08:55:52 +0000 (08:55 -0000)
committerVladimir Krasnov <krasnov@mono-cvs.ximian.com>
Sun, 10 Dec 2006 08:55:52 +0000 (08:55 -0000)
* ConfigurationRemoveElement.cs: fixed key for <remove> element in ConfigurationRemoveElement class

svn path=/trunk/mcs/; revision=69265

mcs/class/System.Configuration/System.Configuration/ChangeLog
mcs/class/System.Configuration/System.Configuration/ConfigurationElementCollection.cs
mcs/class/System.Configuration/System.Configuration/ConfigurationRemoveElement.cs

index a1461aa5bcc90fecb64fdf461e07689c855639ae..a1b650b3d36060f9ef2e0515836be7fd9268b841 100644 (file)
@@ -1,3 +1,9 @@
+2006-12-09  Vladimir Krasnov  <vladimirk@mainsoft.com>
+
+       * ConfigurationElementCollection.cs
+       * ConfigurationRemoveElement.cs: fixed key for <remove> element in
+       ConfigurationRemoveElement class
+
 2006-11-28  Marek Habersack  <grendello@gmail.com>
 
        * SectionGroupInfo.cs: Implement merging of section groups with
index d6098a64d305098c126dcdbf26a138e9a67e63a2..1627a0b82871edc3a2421dc41d76a119aeb6b870 100644 (file)
@@ -38,7 +38,7 @@ using System.Xml;
 namespace System.Configuration 
 {
        [DebuggerDisplayAttribute ("Count = {Count}")]
-       public abstract class ConfigurationElementCollection : ConfigurationElement, ICollection, IEnumerable
+       public abstract partial class ConfigurationElementCollection : ConfigurationElement, ICollection, IEnumerable
        {
                ArrayList list = new ArrayList ();
                ArrayList removed;
@@ -476,7 +476,7 @@ namespace System.Configuration
                                }
                                else if (elementName == removeElementName) {
                                        ConfigurationElement elem = CreateNewElementInternal (null);
-                                       ConfigurationRemoveElement removeElem = new ConfigurationRemoveElement (elem);
+                                       ConfigurationRemoveElement removeElem = new ConfigurationRemoveElement (elem, this);
                                        removeElem.DeserializeElement (reader, true);
                                        BaseRemove (removeElem.KeyValue);
                                        modified = false;
index bb5fb62b42d8f468de50a5e5c5bcc25745c55901..332bcd05e68e480323a4bbcdff5611582ff1dafd 100644 (file)
@@ -34,29 +34,40 @@ using System.Configuration;
 
 namespace System.Configuration
 {
-       internal sealed class ConfigurationRemoveElement : ConfigurationElement
+       partial class ConfigurationElementCollection
        {
-               ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection();
-               string _name = "";
-
-               internal ConfigurationRemoveElement (ConfigurationElement origElement)
+               sealed class ConfigurationRemoveElement : ConfigurationElement
                {
-                       foreach (ConfigurationProperty p in origElement.Properties)
-                               if (p.IsKey)
+                       readonly ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection ();
+                       readonly ConfigurationElement _origElement;
+                       readonly ConfigurationElementCollection _origCollection;
+
+                       internal ConfigurationRemoveElement (ConfigurationElement origElement, ConfigurationElementCollection origCollection)
+                       {
+                               _origElement = origElement;
+                               _origCollection = origCollection;
+
+                               foreach (ConfigurationProperty p in origElement.Properties)
+                                       if (p.IsKey) {
+                                               properties.Add (p);
+                                       }
+                       }
+
+                       internal object KeyValue
+                       {
+                               get
                                {
-                                       properties.Add(p);
-                                       _name = p.Name;
-                               }
-               }
+                                       foreach (ConfigurationProperty p in Properties)
+                                               _origElement [p] = this [p];
 
-               internal object KeyValue
-               {
-                       get { return base [_name]; }
-               }
+                                       return _origCollection.GetElementKey (_origElement);
+                               }
+                       }
 
-               protected internal override ConfigurationPropertyCollection Properties 
-               {
-                       get { return properties; }
+                       protected internal override ConfigurationPropertyCollection Properties
+                       {
+                               get { return properties; }
+                       }
                }
        }
 }