[Mono-dev] [PATCH] Avoid useless check in Convert.ToChar(ushort)

Andreas Färber andreas.faerber at web.de
Sat Nov 15 13:31:53 EST 2008


Am 15.11.2008 um 12:32 schrieb Kornél Pál:

> Index: mcs/class/corlib/System/Convert.cs
> ===================================================================
> --- mcs/class/corlib/System/Convert.cs	(revision 118898)
> +++ mcs/class/corlib/System/Convert.cs	(working copy)
> @@ -681,10 +681,6 @@
> 		[CLSCompliant (false)]
> 		public static char ToChar (ushort value)
> 		{
> -			if (value > Char.MaxValue)
> -				throw new OverflowException (Locale.GetText (
> -					"Value is greater than Char.MaxValue"));
> -	
> 			return (char)value;
> 		}

Does .NET throw an InvalidCastException? No exception is documented.

Andreas



More information about the Mono-devel-list mailing list