c# - Float with either comma ',' or '.' -


I am experiencing a problem while converting a string to float while using C # in asp.net . In the local database, this '.' Works well with marking for float values ​​but after uploading the website to the server it does not work. I think the server only understands ',' instead of ''. '

I remember that I read it somewhere that I have some culture information web I can add to the configuration so that float can understand. ' Or ','

and how can I change it for the WinForm application globally?

Thanks in advance.

You can but you should not do it if it is rooted with the purpose of your code, its Use . should be used as a decimal separator, then you should explicitly use the appropriate culture infode:

  double d = double.Parse (str, cultureInfo.Interiorticulture); // format as a decimal separator, even if it is the present culture.   

This is only when you want to parse according to a culture, which is a culture information Should be used, such as web.config & lt; Globalization & gt; element is set to

Comments