CSharp examples for System.Xml:XML Attribute
Select Single XML Attribute Decimal
using System.Xml; using System;/* ww w . j a v a 2 s .co m*/ public class Main{ public static decimal? SelectSingleAttributeDecimal(XmlNode node, string name, decimal? defaultValue = null) { if (node?.Attributes == null) { return defaultValue; } workAttr = node.Attributes[name]; if (workAttr != null && decimal.TryParse(workAttr.Value, out dTryParse)) { return dTryParse; } return defaultValue; } }