CSharp examples for System.Xml:XML Attribute
Get Long Attr
using System.Xml.Linq; using System;/* w w w . j ava 2s . com*/ public class Main{ public static long GetLongAttr(this XElement elem, string name) { long.TryParse(elem.GetAttrValue(name), out var v); return v; } public static string GetAttrValue(this XElement elem, string attrName) { return elem.Attribute(attrName)?.Value; } }