title: How can I check if an attribute exist in XmlAttributeCollection?
body: <p>I was checking <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmlnode.attributes.aspx" rel="noreferrer">XmlNode.Attributes topic</a> on MSDN about methods for checking if a <code>XmlNode</code> an attribute exists given its name. Well, there is no sample on how to check an item.</p>
  
  <p>I have something like:</p>
  
  <pre><code>  //some code here...
  
    foreach (XmlNode node in n.SelectNodes("Cities/City"))
    {
          //is there some method to check an attribute like
          bool isCapital = node.Attributes.Exist("IsCapital");
  
          //some code here...
    }
  </code></pre>
  
  <p>So, what would be the best approach to check if an attribute exist or not in each node?
  Is it ok to use <code>node.Attribute["IsCapital"]!=null</code> ?</p>