+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
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;
}
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;
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; }
+ }
}
}
}