Mega Code Archive

 
Categories / C# / XML
 

Get int type attribute value

using System; using System.Xml; public class XmlUtil {     #region GetIntAttrib(XmlNode node, string name, out bool found, out bool valid, ref int result)     public static void GetIntAttrib(XmlNode node, string name, out bool found, out bool valid, ref int result)     {         if (node.Attributes == null || node.Attributes[name] == null)         {             found = false;             valid = false;             return;         }         found = true;         valid = Int32.TryParse(node.Attributes[name].InnerText, out result);     }     #endregion }