XmlReader.HasAttributes Propriedade

Definição

Recebe um valor que indica se o nó atual tem algum atributo.

public:
 virtual property bool HasAttributes { bool get(); };
public virtual bool HasAttributes { get; }
member this.HasAttributes : bool
Public Overridable ReadOnly Property HasAttributes As Boolean

Valor de Propriedade

true se o nó atual tiver atributos; caso contrário, false.

Exceções

Um XmlReader método era chamado antes de uma operação assíncrona anterior terminar. Neste caso, InvalidOperationException é lançado com a mensagem "Uma operação assíncrona já está em curso."

Exemplos

O exemplo seguinte mostra todos os atributos do nó atual.

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

Aplica-se a