title: C# Treeview checking if node exists
body: <p>I'm trying to populate a treeview from an XmlDocument.
  The Root of the tree is set as 'Scripts' and from the root the next level should be 'Departments' which is within the XML script.  I can get data from the XML document no problem.  My question is when looping through the XmlDocument and adding nodes to the root node, I want to ensure that if a department is already within the treeview then it is not added again.  I should also add that each Department also has a list of scripts that need to be child nodes of the department.</p>
  
  <p>My code so far is:</p>
  
  <pre><code>        XmlDocument xDoc = new XmlDocument();
          xDoc.LoadXml(scriptInformation);
          TreeNode t1;
          TreeNode rootNode = new TreeNode("Script View");
          treeView1.Nodes.Add(rootNode);
          foreach (XmlNode node in xDoc.SelectNodes("//row"))
          {
              t1 = new TreeNode(node["DEPARTMENT"].InnerXml);
             //How to check if node already exists in treeview?
  
  
  
          }
  </code></pre>
  
  <p>Thanks.</p>