Atributos del lector XML

// Get Xml node attribute keys and values
static IEnumerable<(string key, string value)> GetNodeAttributes(XmlReader reader)
{
    for (int i = 0; i < reader.AttributeCount; i++)
    {
        reader.MoveToAttribute(i);
        yield return (reader.Name, reader.Value);
    }
}

// This can be used with a Linq selector
//to retrieve specific value from the attributes
static string GetAttributeValue(this IEnumerable<(string key, string value)> attributes, string attribute) =>
    attributes.Where(x => x.key == attribute).ToList()[0].value;

// Combine these methods like so to get a attribute neatly.
string value = GetNodeAttributes(reader).GetAttributeValue("name");
Av3