GetValue

public static string GetValue( this XmlNode node )
{
    if ( node != null )
        return node.Value;
    else
        return string.Empty;
}
Example:
var xDoc = new XmlDocument();
xDoc.LoadXml(xml);

var xmlNode = xDoc.SelectSingleNode("//result/text()");
string result = xmlNode.GetValue();

// OR

string result = xDoc.SelectSingleNode("//result/text()").GetValue();

Description

Simply returns the value property from an XmlNode whether it's null or not. Simplifies using XmlDocuments.

Details

Double click on the code to select all.

 

;