Given XElement, is there a way to find out this index of an element in the parent container?
XElement
I know what should be, but I just can't figure it out!
Thank!
Try e.ElementsBeforeSelf().Count()
e.ElementsBeforeSelf().Count()
Try using .ToList().IndexOf()one that returns the index of the object you are going to. Example:
.ToList().IndexOf()
var index = document.Elements().ToList().IndexOf(element);
In vb
Dim Index As String = i.ToString.IndexOf(i.ToString)