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