return value;
}
- if (check_type (vtype, type))
+ if (check_type (vtype, type)) {
+ // These are not supported by Convert
+ if (type.IsEnum)
+ return Enum.ToObject (type, value);
+ 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;
}
if (from == null)
return true;
- TypeCode fromt = Type.GetTypeCode (from);
- TypeCode tot = Type.GetTypeCode (to);
-
if (to.IsByRef != from.IsByRef)
return false;
if (to.IsInterface)
return to.IsAssignableFrom (from);
+ if (to.IsEnum) {
+ to = Enum.GetUnderlyingType (to);
+ if (from == to)
+ return true;
+ }
+
+ TypeCode fromt = Type.GetTypeCode (from);
+ TypeCode tot = Type.GetTypeCode (to);
+
switch (fromt) {
case TypeCode.Char:
switch (tot) {
if (idxlen >= 0 && idxlen != args.Length)
continue;
- if (haveRet && !check_type (p.PropertyType, returnType))
+ if (haveRet && p.PropertyType != returnType)
continue;
int score = Int32.MaxValue - 1;