Get S Byte Elem - CSharp System.Xml

CSharp examples for System.Xml:XML Attribute

Description

Get S Byte Elem

Demo Code


using System.Xml.Linq;
using System;/*from  ww w.  ja va 2 s.  c  o  m*/

public class Main{
        public static sbyte GetSByteElem(this XElement elem, string name)
        {
            sbyte.TryParse(elem.GetElemValue(name), out var v);
            return v;
        }
        public static string GetElemValue(this XElement elem, string elemName)
        {
            return elem.Element(elemName)?.Value;
        }
}

Related Tutorials