Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic A question about the decimal point (Read 1830 times)
chowy
Junior Member
**
Offline


I Love MindFusion!

Posts: 72
Joined: May 8th, 2017
A question about the decimal point
Dec 4th, 2017 at 8:59am
Print Post  
When I set the computer's regional format to German, the default decimal point displayed on the computer changed from "." To ",". when I used the Converter.ToDouble () method provided by mindfusion, for example: '44, 5 ' Will be converted to 445, is wrong. Should be converted to 44.5 fishes.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3447
Joined: Oct 19th, 2005
Re: A question about the decimal point
Reply #1 - Dec 4th, 2017 at 10:05am
Print Post  
Converter's FromDoube and ToDouble methods use CultureInfo.InvariantCulture to format or parse. That's by design because we want saved XML files to not depend on users' current culture. If you want to convert your own data and depend on culture, call double.Parse(stringValue, CultureInfo.CurrentCulture) instead of Converter methods.
  
Back to top
 
IP Logged
 
chowy
Junior Member
**
Offline


I Love MindFusion!

Posts: 72
Joined: May 8th, 2017
Re: A question about the decimal point
Reply #2 - Dec 5th, 2017 at 6:59am
Print Post  
Slavcho wrote on Dec 4th, 2017 at 10:05am:
Converter's FromDoube and ToDouble methods use CultureInfo.InvariantCulture to format or parse. That's by design because we want saved XML files to not depend on users' current culture. If you want to convert your own data and depend on culture, call double.Parse(stringValue, CultureInfo.CurrentCulture) instead of Converter methods.

Ok,I see.
Thank you for your reply!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint