浏览代码

* InvalidEnumArgumentException.cs: Beautify error message.

svn path=/trunk/mcs/; revision=64077
Gert Driesen 19 年之前
父节点
当前提交
f678ff49a5

+ 4 - 0
mcs/class/System/System.ComponentModel/ChangeLog

@@ -1,3 +1,7 @@
+2006-08-20  Gert Driesen  <[email protected]>
+
+	* InvalidEnumArgumentException.cs: Beautify error message.
+
 2006-08-14  Raja R Harinath  <[email protected]>
 
 	* IRaiseItemChangedEvents.cs: Add.  Mentioned in #79012.

+ 4 - 2
mcs/class/System/System.ComponentModel/InvalidEnumArgumentException.cs

@@ -29,6 +29,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+using System.Globalization;
 using System.Runtime.Serialization;
 using System.Security.Permissions;
 
@@ -49,8 +50,9 @@ namespace System.ComponentModel {
 		}
 
 		public InvalidEnumArgumentException (string argumentName, int invalidValue, Type enumClass) :
-			base (argumentName + " is invalid because this value, " + invalidValue + " is not of type " +
-			      enumClass.Name, argumentName)
+			base (string.Format (CultureInfo.CurrentCulture, "Enum argument value"
+					+ " {0} is not valid for {1}. {1} should be a value from {2}.", 
+					invalidValue, argumentName, enumClass.Name), argumentName)
 		{
 		}
 #if NET_2_0