System/PCL: Implement HttpWebRequest.SupportsCookieContainer, WebRequest.CreateHttp...
[mono.git] / mcs / class / System / System.Configuration / SettingsPropertyValue.cs
index fbb1a89516e68f1f76848c6ef8b158d1821c406e..9bf62c00c62a743e986ca0439c5bd075f5f7678f 100644 (file)
@@ -26,7 +26,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_0
 using System;
 using System.Globalization;
 using System.IO;
@@ -160,10 +159,19 @@ namespace System.Configuration
                        }
                }
 
+               internal object Reset ()
+               {
+                       propertyValue = GetDeserializedDefaultValue ();
+                       dirty = true;
+                       defaulted = true;
+                       needPropertyValue = true;
+                       return propertyValue;
+               }
+
                private object GetDeserializedDefaultValue ()
                {
                        if (property.DefaultValue == null)
-                               if (property.PropertyType.IsValueType)
+                               if (property.PropertyType != null && property.PropertyType.IsValueType)
                                        return Activator.CreateInstance (property.PropertyType);
                                else
                                        return null;
@@ -194,7 +202,7 @@ namespace System.Configuration
                        try {
                                switch (property.SerializeAs) {
                                        case SettingsSerializeAs.String:
-                                               if (serializedValue is string && ((string) serializedValue).Length > 0)
+                                               if (serializedValue is string)
                                                        deserializedObject = TypeDescriptor.GetConverter (property.PropertyType).ConvertFromInvariantString ((string) serializedValue);
                                                break;
 #if (XML_DEP)
@@ -235,4 +243,3 @@ namespace System.Configuration
 
 }
 
-#endif