CSharp examples for System.Xml:XML Attribute
Get XML Float Attribute
using System.Xml; public class Main{ public static float GetFloatAttribute(this XmlNode node, string key, float defaultValue) {//from ww w . j av a 2 s. co m XmlAttributeCollection attributes = node.Attributes; float val = defaultValue; if (attributes[key] != null && !string.IsNullOrEmpty(attributes[key].Value)) { float.TryParse(attributes[key].Value, out val); } return val; } }