CSharp examples for System.Xml:XML Element
Get Double from XmlElement
using System.Xml; using System.Text; using System.Collections.Generic; using System;/*from ww w. ja va 2 s.co m*/ public class Main{ public static double GetDouble(XmlElement source, string childName) { string txt = GetText(source, childName); return string.IsNullOrEmpty(txt) ? 0.0 : double.Parse(txt); } public static double GetDouble(XmlElement source, string childName, IFormatProvider formatProvider) { string txt = GetText(source, childName); return string.IsNullOrEmpty(txt) ? 0.0 : double.Parse(txt, formatProvider); } }