I have an XML file, I have a node and I read all ChildNodes. The name of the childNode match to a variable I have to set with the value of this childNode.
In the loo
If you put the names and values in a dictionary, you can easily get the values by name:
Dictionary parameters = xmlParamInstallation.SelectNodes("parameters")[0].ChildNodes .ToDictionary(n => n.Name, n => n.InnerText); myvar1 = parameters["myvar1"]; myvar2 = parameters["myvar2"];