I need to compare two xml documents.
Assume that each of the following XElement's load from a Stream
:
XElement actualElement = XElement.Load(actual);
XElement expectedElement = XElement.Load(expected);
Using that, which of the following two is better:
XNodeEqualityComparer comparer = new XNodeEqualityComparer();
comparer.Equals(actualElement, expectedElement);
or
XElement.DeepEquals(actualElement, expectedElement);
I know that the second option is shorter, but I am more interested in whether or not you get any speed improvements or better/deeper comparison when using one or the other. The comparison itself needs to compare the elements, attributes, and all values between the two xml documents.
The XNodeEqualityComparer.Equals method simply calls the XNode.DeepEquals method. So there is no difference between the two calls.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With