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