XmlReader.MoveToNextAttribute Metoda
Definicja
Gdy jest zastępowany w klasie pochodnej, przenosi do następnego atrybutu.When overridden in a derived class, moves to the next attribute.
public:
abstract bool MoveToNextAttribute();
public abstract bool MoveToNextAttribute ();
abstract member MoveToNextAttribute : unit -> bool
Public MustOverride Function MoveToNextAttribute () As Boolean
Zwraca
true
, jeśli istnieje następny atrybut; false
, jeśli nie ma więcej atrybutów.true
if there is a next attribute; false
if there are no more attributes.
Wyjątki
Metoda XmlReader została wywołana przed ukończeniem poprzedniej operacji asynchronicznej.An XmlReader method was called before a previous asynchronous operation finished. W takim przypadku InvalidOperationException jest generowany z komunikatem "asynchroniczna operacja jest już w toku".In this case, InvalidOperationException is thrown with the message "An asynchronous operation is already in progress."
Przykłady
Poniższy przykład wyświetla wszystkie atrybuty w bieżącym węźle.The following example displays all attributes on the current node.
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
Uwagi
Jeśli bieżący węzeł jest węzłem elementu, ta metoda jest równoważna z MoveToFirstAttribute.If the current node is an element node, this method is equivalent to MoveToFirstAttribute. Jeśli MoveToNextAttribute
zwraca true
, czytelnik przechodzi do następnego atrybutu; w przeciwnym razie pozycja czytnika nie zmienia się.If MoveToNextAttribute
returns true
, the reader moves to the next attribute; otherwise, the position of the reader does not change.