Decimal.Parse loose dot

  • Thread starter Thread starter Luigi Z
  • Start date Start date
L

Luigi Z

Hi all,
in my WinForm application (C# 2.0) that loads some txt file, when I use
Decimal.Parse on string like

"123.45"

it returns me 12345m
But I also have tests that test this feature, and works fine.

How this strange behaviour?

Thanks a lot
 
After serious thinking Luigi Z wrote :
Hi all,
in my WinForm application (C# 2.0) that loads some txt file, when I use
Decimal.Parse on string like

"123.45"

it returns me 12345m
But I also have tests that test this feature, and works fine.

How this strange behaviour?

Thanks a lot

Did you specify a Culture to use in that Parse?
If not, then it will use the CultureInfo.CurrentCulture (or
CurrentUICulture).
For instance an english culture setting will use a decimal dot, whereas
a dutch setting will treat that dot as a thousands separator.

Hans Kesting
 
Hans Kesting said:
Did you specify a Culture to use in that Parse?
If not, then it will use the CultureInfo.CurrentCulture (or
CurrentUICulture).
For instance an english culture setting will use a decimal dot, whereas
a dutch setting will treat that dot as a thousands separator.

Hi Hans, actually it was indeed a culture problem.
Thanks a lot.

Luigi
 
Back
Top