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