I’ve got a program that reads xml files. I already have a code that reads specific elements and places it in a variable. The only thing missing is comparing an element(a number) to a double variable, but elements are considered as string. All I have seen in Google is conversion of double to string. How do you convert a string to double?
EDIT:
I’ve got it now, I can’t answer my own question yet ‘coz I still have low reputation. This is what I’ve come so far and it works:
string stringNum = "2";
double value = double.Parse(stringNum);
See Double.Parse at MSDN
And just as a heads-up, you will probably want to take a look at
Parse(String, IFormatProvider), because parsing XML means you will have to look into the format of your “number strings”. It’s common practice to specify theCultureInfowhen usingToStringorParsemethods. Look here for more information.