title: Check if Xml Node has an Attribute
body: <p>How do I check if a node has particular attribute or not.</p>
  
  <p>What I did is:</p>
  
  <pre><code>string referenceFileName = xmlFileName;
  XmlTextReader textReader = new XmlTextReader(referenceFileName);
  
  while (textReader.Read())
  {
    XmlNodeType nType = textReader.NodeType;
  
    // if node type is an element
    if (nType == XmlNodeType.Element)
    {
      if (textReader.Name.Equals("Control"))
      {
        if (textReader.AttributeCount &gt;= 1)
        {
          String val = string.Empty;
          val = textReader.GetAttribute("Visible");
          if (!(val == null || val.Equals(string.Empty)))
          {
  
          }
        }
      }
    }
  </code></pre>
  
  <p>Is there any function to check that a given attribute is present or not?</p>