c# - Different representations of a decimal point -
i'm seeing difference in behavior between emulator in visual studio , lumia 820 when trying parse double. if have string represent string stringdouble = 3.434233
, emulator correctly parses corresponding double value, on lumia 820 in debug mode, have replace dot comma work. causing difference?
that culture problem.
your simulator , phone probably have different cultures set up, that's why have differences in results. use device or invariant culture.
i recommend either use invariant culture everywhere
double.parse("3.5", cultureinfo.invariantculture)
or current users culture
double number = double.parse("202.667,40", cultureinfo.currentculture);
for both parsing , translating numbers strings, avoid bugs described
Comments
Post a Comment