Convert.ToDouble(“4089.90”) outputs 40.899,00 why?

前端 未结 6 2143
傲寒
傲寒 2021-02-20 16:55

I am developing a software that uses number precision, but I have this problem, it happens that when I take a string to convert to double it outputs me with a different culture.

6条回答
  •  我在风中等你
    2021-02-20 17:40

    I know neither c# nor asp.net, but I think the problem is this: You are performing the operation in a culture where the dot . is the thousands separator and not the decimal separator. The very output you quote is the proof: 40.899,00.

    What culture/locale are you working in?

提交回复
热议问题