CSharp examples for System.Xml:XML Attribute
Get Byte Elem
using System.Xml.Linq; using System;/*from w w w .j av a2s . co m*/ public class Main{ public static byte GetByteElem(this XElement elem, string name) { byte.TryParse(elem.GetElemValue(name), out var v); return v; } public static string GetElemValue(this XElement elem, string elemName) { return elem.Element(elemName)?.Value; } }