开发者

Is LINQ to XML's XElement ordered?

When I use LINQ to XML, is the order of the elements and attributes written out to text guaranteed to 开发者_JAVA技巧be the same order as how I added the XElement and XAttribute objects? Similarly, when I read in an XML document, is it traversed in the same order as it appears in the XML?


However, be aware that XML attributes are specified to be unordered; it would be unwise to rely on any particular ordering of attributes in any code. As a practical matter, many API's don't even make it discoverable in which order the attributes were

Sibling elements have order; attributes do not.


Yes, it is the same order both ways.


Yes, you can use indexing as well, which maps directly to the order they appear in the document.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜