XmlReader.AttributeCount Propriedade
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Quando sobrescrito numa classe derivada, obtém o número de atributos no nó atual.
public:
abstract property int AttributeCount { int get(); };
public abstract int AttributeCount { get; }
member this.AttributeCount : int
Public MustOverride ReadOnly Property AttributeCount As Integer
Valor de Propriedade
O número de atributos no nó atual.
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.
// Display all attributes.
if (reader.HasAttributes) {
Console.WriteLine("Attributes of <" + reader.Name + ">");
for (int i = 0; i < reader.AttributeCount; i++) {
Console.WriteLine(" {0}", reader[i]);
}
// Move the reader back to the element node.
reader.MoveToElement();
}
' Display all attributes.
If reader.HasAttributes Then
Console.WriteLine("Attributes of <" + reader.Name + ">")
Dim i As Integer
For i = 0 To (reader.AttributeCount - 1)
Console.WriteLine(" {0}", reader(i))
Next i
' Move the reader back to the element node.
reader.MoveToElement()
End If
Observações
Esta propriedade é relevante apenas para Elementnós.DocumentTypeXmlDeclaration (Outros tipos de nós não têm atributos.)