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