[Mono-dev] Parse methods

Michael Schurter michael at synthesyssolutions.com
Wed Feb 1 10:05:24 EST 2006


Mayur Devendra Punekar wrote:
> - I am tring to covert string to float and double with the help of 
> float.Parse and Double.Parse method, but its not returning proper 
> values, e.g
> 
> string s = "1.0";
> double d = Double.Parse(s);
> 
> this codes gives d = 10 !! (i.e. without decimal point)

Works for me:
string s = "1.0";
double d = double.Parse(s);
Console.WriteLine(d);

Outputs 1 as expected.  Changed s to "1.1" outputs 1.1 as expected.  I'm 
using Mono 1.1.13.1 on Debian Etch.

Michael Schurter



More information about the Mono-devel-list mailing list