[Mono-list] Convert.ToSingle/Convert.ToDouble with empty string
succeeds
Brian Pickles
brian at bsquaredsen.co.uk
Thu Mar 16 12:08:35 EST 2006
Colin,
MS CLR throws a System.FormatException.
Brian
On 3/16/06, Colin JN Breame <colin at breame.net> wrote:
>
> It appears that if you use Convert.ToSingle or Convert.ToDouble on an
> empty
> string, the method succeeds and returns 0.
>
> e.g.
>
> public class test_t {
> public static void Main() {
> System.Console.WriteLine(System.Convert.ToSingle(""));
> }
> }
>
> $ mcs test.cs && mono test.exe
> 0
>
> I would expect it to throw a System.FormatException like Convert.ToInt32
> . How
> does this compare to the MS CLR behaviour? Is this a bug or a feature?
>
> -- Colin
>
> PS. mono 1.1.13.4
> _______________________________________________
> Mono-list maillist - Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
--
Brian Pickles
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20060316/687ac631/attachment-0001.html
More information about the Mono-list
mailing list