CSharp examples for System.Xml:XML Attribute
Get Int Attr
using System.Xml.Linq; using System;/*w ww . ja va 2 s . c o m*/ public class Main{ public static int GetIntAttr(this XElement elem, string name) { int.TryParse(elem.GetAttrValue(name), out var v); return v; } public static string GetAttrValue(this XElement elem, string attrName) { return elem.Attribute(attrName)?.Value; } }