Browse Source

This version of Gonzalo's patch wont break the build

svn path=/trunk/mcs/; revision=47627
Miguel de Icaza 20 years ago
parent
commit
970de46470
1 changed files with 8 additions and 2 deletions
  1. 8 2
      mcs/class/corlib/System/Enum.cs

+ 8 - 2
mcs/class/corlib/System/Enum.cs

@@ -339,8 +339,14 @@ namespace System
 						break;
 					}
 				}
-				if (!found)
-					throw new ArgumentException ("The requested value was not found.");
+				if (!found){
+					try {
+						// Attempt to convert to numeric type
+						return ToObject (enumType, Convert.ChangeType (value, typeCode) );
+					} catch {
+						throw new ArgumentException ("The requested value was not found.");
+					}
+				}
 				
 			}
 			return ToObject (enumType, retVal);