XmlReader.MoveToNextAttribute メソッド

定義

派生クラスでオーバーライドされると、次の属性に移動します。

public:
 abstract bool MoveToNextAttribute();
public abstract bool MoveToNextAttribute();
abstract member MoveToNextAttribute : unit -> bool
Public MustOverride Function MoveToNextAttribute () As Boolean

返品

true 次の属性がある場合。属性がこれ以上ない場合は false します。

例外

前の非同期操作が完了する前に、 XmlReader メソッドが呼び出されました。 この場合、"非同期操作は既に進行中です" というメッセージで InvalidOperationException がスローされます。

次の例では、現在のノードのすべての属性を表示します。

if (reader.HasAttributes) {
  Console.WriteLine("Attributes of <" + reader.Name + ">");
  while (reader.MoveToNextAttribute()) {
    Console.WriteLine(" {0}={1}", reader.Name, reader.Value);
  }
  // Move the reader back to the element node.
  reader.MoveToElement();
}
If reader.HasAttributes Then
  Console.WriteLine("Attributes of <" + reader.Name + ">")
  While reader.MoveToNextAttribute()
    Console.WriteLine(" {0}={1}", reader.Name, reader.Value)
  End While
  ' Move the reader back to the element node.
  reader.MoveToElement()
End If

注釈

現在のノードが要素ノードの場合、このメソッドは MoveToFirstAttributeと同じです。 MoveToNextAttribute trueが返された場合、リーダーは次の属性に移動します。それ以外の場合、リーダーの位置は変更されません。

適用対象