How to isolate the regional settings in c#
My product (I'm using Microsoft.Office开发者_运维知识库.Interop.Excel) is targeted to a Portuguese audience where the comma is the decimal symbol. It have a lot of float and double calculations and percentage too. So, when I run the program on a Windows with regional settings set to United States the program runs well, when I run the program on a Windows with regional settings set to Brazil, a lot of wrong things happen, like percentage goes crazy (a lot of zeros and other numbers), some calculations result in a infinite result and more...
My question is, how can I isolate the regional settings in C# solution? Like put a fix regional settings in USA even if the Windows is configured with Brazil? Is this possible? If not, we have other way to fix that?
Thanks in advance.
Lincoln
Have you tried playing around with the System.Globalization.CultureInfo class? Specifically, CultureInfo.CurrentCulture?
精彩评论