}
else if (a is DefaultSettingValueAttribute) {
defaultValue = ((DefaultSettingValueAttribute)a).Value; /* XXX this is a string.. do we convert? */
+ if (prop.PropertyType != typeof(string)) {
+ defaultValue = TypeDescriptor.GetConverter(prop.PropertyType).ConvertFromString((string)defaultValue);
+ }
}
else if (a is SettingsSerializeAsAttribute) {
serializeAs = ((SettingsSerializeAsAttribute)a).SerializeAs;
+2006-06-29 Atsushi Enomoto <atsushi@ximian.com>
+
+ * ApplicationSettingsBase.cs : When we use default value, convert it
+ to proper type. Fixed bug #78654. Patch by Gareth Pearce.
+
2006-05-30 Gert Driesen <drieseng@users.sourceforge.net>
* ConfigurationException.cs: BareMessage, Filename and Line properties
class Bug78430 : SettingsBase
{
}
+
+ [Test] // bug #78654
+ public void DefaultSettingValueAs ()
+ {
+ Assert.AreEqual (1, new Bug78654 ().IntSetting);
+ }
+
+ class Bug78654 : ApplicationSettingsBase
+ {
+ [UserScopedSettingAttribute ()]
+ [DefaultSettingValueAttribute ("1")]
+ public int IntSetting {
+ get { return ((int)(this ["IntSetting"])); }
+ }
+ }
}
}
+2006-06-29 Atsushi Enomoto <atsushi@ximian.com>
+
+ * ApplicationSettingsBaseTest.cs : added test for bug #78654.
+
2006-05-17 Atsushi Enomoto <atsushi@ximian.com>
* LocalFileSettingsProviderTest.cs : commented some lines in