Select Single XML Text Decimal - CSharp System.Xml

CSharp examples for System.Xml:XPath

Description

Select Single XML Text Decimal

Demo Code


using System.Xml;
using System;//from w w  w .j a  v  a  2  s .  co m

public class Main{
        public static decimal? SelectSingleTextDecimal(XmlNode node, string selector, decimal? defaultValue = null)
    {
        workNode = node.SelectSingleNode(selector, Manager);
        if (workNode != null && decimal.TryParse(workNode.InnerText, out dTryParse))
        {
            return dTryParse;
        }

        return defaultValue;
    }
}

Related Tutorials