Merge pull request #364 from directhex/master
[mono.git] / mcs / class / System.Configuration / System.Configuration / KeyValueConfigurationElement.cs
index 9cd2c35a4ae7390089d49db4562244aa82fecd61..66476dd0bcbbb14260df4570cfa6951defd68b51 100644 (file)
@@ -34,36 +34,49 @@ namespace System.Configuration
 {
        public class KeyValueConfigurationElement: ConfigurationElement
        {
-//             ConfigurationPropertyCollection properties;
-               
+               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; }
                }
-               
-/*             protected internal override void Init ()
+
+               [MonoTODO]
+               protected internal override void Init ()
                {
                }
                
                protected internal override ConfigurationPropertyCollection Properties {
                        get { return properties; }
                }
-*/     }
+       }
 }
 #endif