Get As String - CSharp System.Xml

CSharp examples for System.Xml:XML Attribute

Description

Get As String

Demo Code


using System.Xml.Linq;
using System;/* w  w  w .  j a  va 2  s.co  m*/

public class Main{
        #region GetAsString Method
        public static string GetAsString(this XAttribute attr)
        {
            string ret = string.Empty;

            if (attr != null && !string.IsNullOrEmpty(attr.Value))
            {
                ret = attr.Value;
            }

            return ret;
        }
}

Related Tutorials