diff options
author | Lluis Sanchez <lluis@novell.com> | 2004-05-05 21:05:53 +0400 |
---|---|---|
committer | Lluis Sanchez <lluis@novell.com> | 2004-05-05 21:05:53 +0400 |
commit | 158becb0c37c4c7b1b975d8e2b30d2767f53247f (patch) | |
tree | 432390530ddcef086b95c566c3cc7844f2538118 /mcs/class/System/System.ComponentModel | |
parent | 881f005dfd1cfbe80a32e3ab44e34baac56e0163 (diff) |
* BooleanConverter.cs: Improved ConverFrom method.
svn path=/trunk/mcs/; revision=26771
Diffstat (limited to 'mcs/class/System/System.ComponentModel')
-rw-r--r-- | mcs/class/System/System.ComponentModel/BooleanConverter.cs | 15 | ||||
-rw-r--r-- | mcs/class/System/System.ComponentModel/ChangeLog | 4 |
2 files changed, 8 insertions, 11 deletions
diff --git a/mcs/class/System/System.ComponentModel/BooleanConverter.cs b/mcs/class/System/System.ComponentModel/BooleanConverter.cs index 9f637774b33..1f53bcaa13f 100644 --- a/mcs/class/System/System.ComponentModel/BooleanConverter.cs +++ b/mcs/class/System/System.ComponentModel/BooleanConverter.cs @@ -29,17 +29,10 @@ namespace System.ComponentModel public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value) { - if (value.GetType() == typeof (string)) { - string Test = ((String) value).ToLower (culture); - if (Test.Equals ("true")) - return true; - else if (Test.Equals ("false")) - return false; - else - throw new FormatException ("No valid boolean value"); - } - - return base.ConvertFrom (context, culture, value); + if (value is string) + return bool.Parse ((string) value); + else + return base.ConvertFrom (context, culture, value); } public override StandardValuesCollection GetStandardValues (ITypeDescriptorContext context) diff --git a/mcs/class/System/System.ComponentModel/ChangeLog b/mcs/class/System/System.ComponentModel/ChangeLog index 6ba49fc8e90..155415c045a 100644 --- a/mcs/class/System/System.ComponentModel/ChangeLog +++ b/mcs/class/System/System.ComponentModel/ChangeLog @@ -1,3 +1,7 @@ +2004-05-05 Lluis Sanchez Gual <lluis@ximian.com> + + * BooleanConverter.cs: Improved ConverFrom method. + 2004-04-28 Lluis Sanchez Gual <lluis@ximian.com> * TypeDescriptor.cs: Do not return attributes that have the same TypeID. |