Index of Child XElement
G开发者_如何学Goiven an XElement
is there a way to find out that element's index within the parent container?
I know there must be but I just can't figure it out!
Thanks!
Try e.ElementsBeforeSelf().Count()
Try using .ToList().IndexOf()
which returns the index of the object you pass in. Example:
var index = document.Elements().ToList().IndexOf(element);
In VB
Dim Index As String = i.ToString.IndexOf(i.ToString)
精彩评论