XmlTextReader.MoveToNextAttribute Método

Definición

Se mueve al siguiente atributo.

C#
public override bool MoveToNextAttribute ();

Devoluciones

Boolean

Es true si hay siguiente atributo; es false si no hay más atributos.

Ejemplos

En el ejemplo siguiente se muestran todos los atributos del nodo actual.

C#
public void DisplayAttributes(XmlReader reader)
{
    if (reader.HasAttributes)
    {
        Console.WriteLine("Attributes of <" + reader.Name + ">");
        while (reader.MoveToNextAttribute())
        {
            Console.WriteLine(" {0}={1}", reader.Name, reader.Value);
        }
    }
}

Comentarios

Nota

A partir de .NET Framework 2.0, se recomienda crear XmlReader instancias mediante el XmlReader.Create método para aprovechar las nuevas funcionalidades.

Si el nodo actual es un nodo de elemento, este método es equivalente a MoveToFirstAttribute. Si MoveToNextAttribute devuelve true, el lector se mueve al atributo siguiente; de lo contrario, la posición del lector no cambia.

Se aplica a

Producto Versiones
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
.NET Standard 2.0, 2.1

Consulte también