2007-11-13 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mcs / class / System.Configuration / System.Configuration / KeyValueConfigurationElement.cs
index aa676223855c4f0f221511e0f53e29de9ed9197a..66476dd0bcbbb14260df4570cfa6951defd68b51 100644 (file)
@@ -34,21 +34,39 @@ namespace System.Configuration
 {
        public class KeyValueConfigurationElement: ConfigurationElement
        {
+               static ConfigurationProperty keyProp;
+               static ConfigurationProperty valueProp;
+               static ConfigurationPropertyCollection properties;
+
+               static KeyValueConfigurationElement ()
+               {
+                       keyProp = new ConfigurationProperty ("key", typeof (string), "", ConfigurationPropertyOptions.IsKey);
+                       valueProp = new ConfigurationProperty ("value", typeof (string), "");
+
+                       properties = new ConfigurationPropertyCollection ();
+                       properties.Add (keyProp);
+                       properties.Add (valueProp);
+               }
+
+               internal KeyValueConfigurationElement ()
+               {
+               }
+
                public KeyValueConfigurationElement (string key, string value)
                {
-                       this["key"] = key;
-                       this ["value"] = value;
+                       this[keyProp] = key;
+                       this[valueProp] = value;
                }
                
                [ConfigurationProperty ("key", DefaultValue = "", Options = ConfigurationPropertyOptions.IsKey)]
                public string Key {
-                       get { return (string) this["key"]; }
+                       get { return (string) this[keyProp]; }
                }
                
                [ConfigurationProperty ("value", DefaultValue = "")]
                public string Value {
-                       get { return (string) this["value"]; }
-                       set { this ["value"] = value; }
+                       get { return (string) this[valueProp]; }
+                       set { this [valueProp] = value; }
                }
 
                [MonoTODO]
@@ -56,9 +74,8 @@ namespace System.Configuration
                {
                }
                
-               [MonoTODO ("why override?")]
                protected internal override ConfigurationPropertyCollection Properties {
-                       get { return base.Properties; }
+                       get { return properties; }
                }
        }
 }