Net PerfectDev

Net PerfectDev

  • 1.6k
  • 146
  • 4.7k

use of decimal symbol

Mar 1 2022 10:35 AM

Hello,
I wrote a simple program which allows to test the number in double type. The objective is to read an xml file according to the decimal symbol chosen by the user.

when the user changes the configuration of decimal symbol the program must work with this modification without changing each time the xml file.

XDocument xdoc = XDocument.Parse(Properties.Resources.Number);
string number = xdoc.Element("Number").Attribute("value").Value;double result;
var isDouble = Double.TryParse(number, out result);
if (!isDouble)Console.WriteLine("Error:Number is not a double");
elseConsole.WriteLine("Congratulations: it's a Double number");

so how do I process my code to make the value="1,2" acceptable even if the user changes their decimal symbol?


Answers (2)