c# - What's the difference between XElement and XDocument? -
what difference between xelement
, xdocument
, when use each?
xdocument represents whole xml document. composed of number of elements.
xelement represents xml element (with attributes, children etc). part of larger document.
use xdocument when working whole xml document, xelement when working xml element.
for example - xelement
has hasattributes
property indicating whether attributes exist on element, xdocument
doesn't, such property meaningless in context of whole xml document.
Comments
Post a Comment