title: How to get the XML node name?
body: <p>I am doing a challenge thing but I am struggling to get the name of the XML node, "folder". I am trying to return all folders that begin with 'u'. </p>
  
  <p>I want to output to be "Uninstall Information" and "Users" but I still have all the XML structure.</p>
  
  <p>Any help would be great.</p>
  
  <pre><code> class Program
      {
          public static IEnumerable&lt;string&gt; FolderNames(string xml, char startingLetter)
          {
              List&lt;string&gt; elem = new List&lt;string&gt;();
              List&lt;int&gt; list = new List&lt;int&gt;();
  
              XmlDocument xmldoc = new XmlDocument();
              xmldoc.LoadXml(xml);
  
              XmlNodeList temp = xmldoc.SelectNodes("folder");
  
               elem.Add(temp[0].InnerXml);
               Console.WriteLine(elem[0]);
  
              return elem;
          }
  
          public static void Main(string[] args)
          {
              string xml =
                  "&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;" +
                  "&lt;folder name=\"c\"&gt;" +
                  "&lt;folder name=\"program files\"&gt;" +
                  "&lt;folder name=\"uninstall information\" /&gt;" +
                  "&lt;/folder&gt;" +
                  "&lt;folder name=\"users\" /&gt;" +
                  "&lt;/folder&gt;";
  
              Program.FolderNames(xml, 'u');
  
              //foreach (string name in Program.FolderNames(xml, 'u'))
                  //Console.WriteLine(name);
          }
      }
  }
  </code></pre>