What is the fastest way to combine two xml files into one

后端 未结 11 1549
广开言路
广开言路 2020-11-29 01:43

If I have two string of xml1 and xml2 which both represent xml in the same format. What is the fastest way to combine these together? The format is not important, but I ju

11条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-29 02:04

    This is the fastest and cleanest way to merge xml files.

    XElement xFileRoot = XElement.Load(file1.xml);
    XElement xFileChild = XElement.Load(file2.xml);
    xFileRoot.Add(xFileChild);
    xFileRoot.Save(file1.xml);
    

提交回复
热议问题