How to update original variable?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
This is littile embarassing but I am unabel to solve this so its time to ask for help...

I have input as XML as ExtractXml
I need to update first name.
Here is my code. As you can see, I am updating the local variable XmlNodeListObj.ChildNodes[0].Value, but how do I update the original variable? namely ExtractXml?

Everything else works fine, except that my original string is not updated


xdoc.LoadXml(ExtractXml);
System.Xml.XmlNodeList XmlNodeListObj = xdoc.GetElementsByTagName("FirstName");
int count = XmlNodeListObj.Count;
int i = 0;
while (i < count)
{
// Return the first name.
name = XmlNodeListObj.ChildNodes[0].Value;
XmlNodeListObj[i++].ChildNodes[0].Value = ToTitleCase(name);// this fixes name
}


View the full article
 
Back
Top