[System] Removal of the NET_2_0 in the source code
[mono.git] / mcs / class / System / System.Net.Configuration / WebRequestModuleElement.cs
old mode 100755 (executable)
new mode 100644 (file)
index 5eb62b4..95acd06
@@ -3,9 +3,10 @@
 //
 // Authors:
 //     Tim Coleman (tim@timcoleman.com)
+//     Chris Toshok (toshok@ximian.com)
 //
 // Copyright (C) Tim Coleman, 2004
-// (c) 2004 Novell, Inc. (http://www.novell.com)
+// (C) 2004,2005 Novell, Inc. (http://www.novell.com)
 //
 
 //
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_0 && XML_DEP
+#if CONFIGURATION_DEP
 
 using System;
+using System.ComponentModel;
 using System.Configuration;
 
 namespace System.Net.Configuration 
@@ -40,24 +42,31 @@ namespace System.Net.Configuration
        {
                #region Fields
 
-               ConfigurationPropertyCollection properties;
-               static ConfigurationProperty prefix = new ConfigurationProperty ("Prefix", typeof (string), null);
-               static ConfigurationProperty type = new ConfigurationProperty ("Type", typeof (string), null);
+               static ConfigurationPropertyCollection properties;
+               static ConfigurationProperty prefixProp;
+               static ConfigurationProperty typeProp;
 
                #endregion // Fields
 
                #region Constructors
 
-               public WebRequestModuleElement ()
+               static WebRequestModuleElement ()
                {
+                       prefixProp = new ConfigurationProperty ("prefix", typeof (string), null, ConfigurationPropertyOptions.IsKey | ConfigurationPropertyOptions.IsRequired);
+                       typeProp = new ConfigurationProperty ("type", typeof (string));
                        properties = new ConfigurationPropertyCollection ();
-                       properties.Add (prefix);
-                       properties.Add (type);
+
+                       properties.Add (prefixProp);
+                       properties.Add (typeProp);
+               }
+
+               public WebRequestModuleElement ()
+               {
                }
 
                public WebRequestModuleElement (string prefix, string type)
                {
-                       base [type] = type;
+                       base[typeProp] = type;
                        Prefix = prefix;
                }
 
@@ -70,18 +79,21 @@ namespace System.Net.Configuration
 
                #region Properties
 
+               [ConfigurationProperty ("prefix", Options = ConfigurationPropertyOptions.IsKey | ConfigurationPropertyOptions.IsRequired)]
                public string Prefix {
-                       get { return (string) base [prefix]; }
-                       set { base [prefix] = value; }
+                       get { return (string) base [prefixProp]; }
+                       set { base [prefixProp] = value; }
                }
 
-               protected internal override ConfigurationPropertyCollection Properties {
-                       get { return properties; }
+               [ConfigurationProperty ("type")]
+               [TypeConverter (typeof (TypeConverter))]
+               public Type Type {
+                       get { return Type.GetType ((string) base [typeProp]); }
+                       set { base [typeProp] = value.FullName; }
                }
 
-               public Type Type {
-                       get { return Type.GetType ((string) base [type]); }
-                       set { base [type] = value.FullName; }
+               protected override ConfigurationPropertyCollection Properties {
+                       get { return properties; }
                }
 
                #endregion // Properties