XmlReader.MoveToFirstAttribute Método
Definição
Quando substituído em uma classe derivada, move o primeiro atributo.When overridden in a derived class, moves to the first attribute.
public:
abstract bool MoveToFirstAttribute();
public abstract bool MoveToFirstAttribute ();
abstract member MoveToFirstAttribute : unit -> bool
Public MustOverride Function MoveToFirstAttribute () As Boolean
Retornos
true
se um atributo existir (o leitor é movido para o primeiro atributo); caso contrário, false
(a posição do leitor não é alterada).true
if an attribute exists (the reader moves to the first attribute); otherwise, false
(the position of the reader does not change).
Exceções
Um método XmlReader foi chamado antes do término de uma operação assíncrona anterior.An XmlReader method was called before a previous asynchronous operation finished. Nesse caso, InvalidOperationException será gerado com a mensagem “Uma operação assíncrona já está em andamento”.In this case, InvalidOperationException is thrown with the message "An asynchronous operation is already in progress."
Exemplos
O exemplo a seguir obtém o valor do primeiro atributo.The following example gets the value of the first attribute.
reader.ReadToFollowing("book");
reader.MoveToFirstAttribute();
string genre = reader.Value;
Console.WriteLine("The genre value: " + genre);
reader.ReadToFollowing("book")
reader.MoveToFirstAttribute()
Dim genre As String = reader.Value
Console.WriteLine("The genre value: " + genre)