I load two XElements from two different files. One is a default file and the other is the live XML. Basically I need to know how to compare the two XElements and get a collection of all Elements that are in the live file and not in the defaultfile.
I don’t care about checking for values I only care if there is an element in the live file that isn’t in the default file.
Basically I am comparing two Web.config files and when a user is upgrading our product I need to check their web.config to find any element they have added that isn’t in our template and add them to our template before I lay it down and overwrite theirs.
Try this:
This approach constructs a list of
liveXml‘s element names that are not present indefXml, puts them in a set, and then uses that set to filterliveXml‘s elements.For removed elements, reverse the order of operand that you pass to
Except, and filterdefXml: