开发者

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜