Potential calculation erros in Double.TryParse and Double.Parse with Invariant culture and NumberStyles.Any
Issue (example): Double.Parse("77,65", System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture)
return 7765
Cause: System.Globalization.NumberStyles.AllowThousands https://stackoverflow.com/questions/46109025/c-sharp-double-tryparse-with-invariantculture-returns-unexpected-result
Sample for fix: use Public Shared NumberStyleAnyWithoutAllowThousands as NumberStyles = NumberStyles.Any - NumberStyles.AllowThousands
instead NumberStyles.Any
Thanks @AlexanderSemenyak for the valuable tip. Maybe this will do the trick? https://github.com/DanWBR/dwsim5/commit/ef026a927d1b89dd5c9243f28ba82a66dff60f07
Thank's :)
But also great idea - replace all Double.Parse (TryParse) for other code by this extensions methods from General.vb