how to handle culture in double parsing in c#?

十年热恋 提交于 2019-12-06 11:09:08
Sriram Sakthivel

No, there is no generic way. You either need to know what culture the double was formatted or all the servers need to send in a single format, say InvariantCulture.

If you guess the culture, there's a bad news waiting for you as different cultures use different decimal separator, group separator etc. So you can't.

Refer this to foresee what can go wrong if you guess.

Hajo Lemcke

Please see https://stackoverflow.com/a/27443540/1230816 for an answer to your examples without any cultural assumptions required.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!