Get String Attr - CSharp System.Xml

CSharp examples for System.Xml:XML Attribute

Description

Get String Attr

Demo Code


using System.Xml.Linq;
using System;//from  www .  ja v  a2 s. com

public class Main{
        public static string GetStringAttr(this XElement elem, string name)
        {
            return elem.GetAttrValue(name);
        }
        public static string GetAttrValue(this XElement elem, string attrName)
        {
            return elem.Attribute(attrName)?.Value;
        }
}

Related Tutorials