Answer the question
In order to leave comments, you need to log in
What is the correct way to overwrite the value of an XML element in c#.net?
I want <fileOpen> </fileOpen>
to change the value between, it doesn't work for some reason
XmlDocument doc = new XmlDocument();
doc.Load(GetFileName());
//
//choose node for editing
XmlNode node = doc.SelectSingleNode($"/users/user[name={_PersonName} ]"); //node у меня null почемуто
XmlNode nodeFile = node.NextSibling; //помогите
nodeFile = node.NextSibling;
nodeFile.Value = openedFile;
doc.Save(GetFileName());
<users>
<user>
<name>dfg</name>
<fileOpen>
</fileOpen>
</user>
</users>
Answer the question
In order to leave comments, you need to log in
doc.SelectSingleNode([email protected]"users/user[name=""{_PersonName}""]").LastChild.InnerText = openedFile;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question