Hello I'm trying to combine two XML files. However, I never get the connection in the right place. I tried two things but without success.
The two XML files look like this:
and they should look like this after:
I tried like
1#
var combinedUnique = doc2.Descendants("Actors")
.Union(doc1.Descendants("Actors"));
combinedUnique.First().Save(path);
But this deletes the Root and every "Actors"..
MyDoc.Root.Add(XDocument.Load(System.IO.Path.Combine(Application.dataPath, "Resources/actors2.xml")).Descendants("Actor"));
MyDoc.Save(path);
And this adds the "Actor" under "Actors".
But i want to merge all "Actor" into "Actors" but how?
question from:
https://stackoverflow.com/questions/65884371/merge-two-xml-files-in-c-sharp 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…