我有条件地更改XmlDocument代码的各个部分。不是传递“更改”标志,而是XmlDocument对象是否有为此构建的标志(如isDirty)?
var doc = new XmlDocument();
doc.Load(file);
if (...) parent.AppendChild(element);
if (...) parent2.AppendChild(element2);
if (...) parent3.AppendChild(element3);
//METHOD DOESN'T EXIST
if (doc.isDirty())
doc.Save(file);