XmlReader.HasAttributes Proprietà
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Ottiene un valore che indica se il nodo corrente dispone di attributi.
public:
virtual property bool HasAttributes { bool get(); };
public virtual bool HasAttributes { get; }
member this.HasAttributes : bool
Public Overridable ReadOnly Property HasAttributes As Boolean
Valore della proprietà
true se il nodo corrente ha attributi; in caso contrario, false.
Eccezioni
È stato chiamato un XmlReader metodo prima del completamento di un'operazione asincrona precedente. In questo caso, InvalidOperationException viene generata con il messaggio "Un'operazione asincrona è già in corso".
Esempio
Nell'esempio seguente vengono visualizzati tutti gli attributi nel nodo corrente.
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