現在のXMLタグのインデックスを取得するにはどうすればよいですか?
例:
<User>
<Contact>
<Name>Lucas</Name>
</Contact>
<Contact>
<Name>Andre</Name>
</Contact>
...
</User>
私は以下のコードを試しています
foreach (var element2 in doc2.Root.Descendants())
{
String name = element.Name.LocalName;
String value = element.Value;
}
<Contact>
最初のタグを読んでいるのか、2番目のタグを読んでいるのか、3番目のタグを読んでいるのかを知りたい...