Gets the inner XML of a node or returns empty if the node is null. - CSharp System.Xml

CSharp examples for System.Xml:XML Node

Description

Gets the inner XML of a node or returns empty if the node is null.

Demo Code


using System.Xml;

public class Main{
        /// <summary>
        /// Gets the inner XML of a node or returns empty if the node is null.
        /// </summary>
        /// <param name="node">The node.</param>
        public static string GetInnerXmlOrEmpty(this XmlNode node)
        {/*www  . ja  va 2s. co  m*/
            string result = string.Empty;
            if (node != null)
            {
                result = node.InnerText;
            }
            return result;
        }
}

Related Tutorials