CSharp examples for System.Xml:XML Attribute
Get As Double
using System.Xml.Linq; using System;/* www .j a va 2 s. c o m*/ public class Main{ #endregion #region GetAsDouble Method public static double GetAsDouble(this XAttribute attr) { double ret = 0; double value = 0; if (attr != null && !string.IsNullOrEmpty(attr.Value)) { if (double.TryParse(attr.Value, out value)) ret = value; } return ret; } }