CSharp examples for System.Xml:XML Element
Get UShort Element from XElement
using System.Xml.Linq; using System;//from w ww. j av a 2 s . com public class Main{ public static ushort GetUShortElem(this XElement elem, string name) { ushort.TryParse(elem.GetElemValue(name), out var v); return v; } public static string GetElemValue(this XElement elem, string elemName) { return elem.Element(elemName)?.Value; } }