开发者

Index of Child XElement

开发者 https://www.devze.com 2023-03-19 21:11 出处:网络
G开发者_如何学Goiven an XElement is there a way to find out that element\'s index within the parent container?

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)
0

精彩评论

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