Przeglądaj źródła

2008-03-14 Zoltan Varga <[email protected]>

	* Binder.cs (ChangeType): Add support for Char->Double/Single conversations. Fixes
	#367655.

svn path=/trunk/mcs/; revision=98264
Zoltan Varga 18 lat temu
rodzic
commit
9bb4db6093

+ 9 - 1
mcs/class/corlib/System.Reflection/Binder.cs

@@ -212,8 +212,16 @@ namespace System.Reflection
 						return value;
 				}
 
-				if (check_type (vtype, type))
+				if (check_type (vtype, type)) {
+					// These are not supported by Convert
+					if (vtype == typeof (Char)) {
+						if (type == typeof (double))
+							return (double)(char)value;
+						if (type == typeof (float))
+							return (float)(char)value;
+					}
 					return Convert.ChangeType (value, type);
+				}
 				return null;
 			}
 

+ 5 - 0
mcs/class/corlib/System.Reflection/ChangeLog

@@ -1,3 +1,8 @@
+2008-03-14  Zoltan Varga  <[email protected]>
+
+	* Binder.cs (ChangeType): Add support for Char->Double/Single conversations. Fixes
+	#367655.
+
 2008-03-10  Gert Driesen  <[email protected]>
 
 	* Assembly.cs (GetFile): Fixed exception messages and param name.