Get String Elem - CSharp System.Xml

CSharp examples for System.Xml:XML Attribute

Description

Get String Elem

Demo Code


using System.Xml.Linq;
using System;/* ww  w . ja  va  2s . co  m*/

public class Main{
        public static string GetStringElem(this XElement elem, string name)
        {
            return elem.GetElemValue(name);
        }
        public static string GetElemValue(this XElement elem, string elemName)
        {
            return elem.Element(elemName)?.Value;
        }
}

Related Tutorials