View Single Post
  #67  
Old 10-20-2011, 09:35 PM
41Sqn_Banks 41Sqn_Banks is offline
Approved Member
 
Join Date: Oct 2007
Posts: 644
Default

Quote:
Originally Posted by Ataros View Post
Thank you very much for the fix!

Was it a regional settings issue like decimal comma or data format, anything we need to know?
For some reason I was unable to post it at sukhoi, thanks for posting the update. Yes I missed to parse 2 values in with invariant culture number format. This caused the flight size to be 0 so no flight was available in the mission.

If you want to convert a string to a double value, for example
Code:
string inputString = "0.5";
you should use
Code:
double outputDouble;
double.TryParse(inputString, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture.NumberFormat, out outputDouble);
If you want to convert a double value to a string you should use
Code:
double someDoubleValue = 0.5;
someDoubleValue.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat)
If you don't use the InvariantCulture the default language culture of your system (or application) is used. Depending on this language culture the expected seperator can be "," which causes the parsing to fail if the input string uses "." as seperator. The same goes for the convertion from double to string.

Last edited by 41Sqn_Banks; 10-21-2011 at 07:26 AM.
Reply With Quote