title: What is the proper way to retrieve a value from a single, nested, XElement?
body: <p>To retieve the value of a nested XElement I have the following in my code:</p>
  
  <pre><code>XElement xml = new XElement("UserDefinedSettings", new XElement("RootFolder", new XElement("FolderName", "User Input Goes Here")));
  
  xml.Save("UserDefinedSettings.xml");
  </code></pre>
  
  <p>Which gives me this saved to the hard drive:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;UserDefinedSettings&gt;
    &lt;RootFolder&gt;
      &lt;FolderName&gt;User Input Goes Here&lt;/FolderName&gt;
    &lt;/RootFolder&gt;
  &lt;/UserDefinedSettings&gt;
  </code></pre>
  
  <p>Later, To retrieve the name of the folder that the user has chosen I am using:</p>
  
  <pre><code>XDocument xdoc = XDocument.Load("UserDefinedSettings.xml");
  
  var myVar = xdoc.Descendants("FolderName").Single();
  
  textBox1.Text = myVar.Value;
  </code></pre>
  
  <p>I am new to Linq-XML and I am wondering if what I have done is the right way to go about it?</p>
  
  <p>Initially I had been using the following line of code to get the name of the folder, but I knew there had to be a better way and after searching here on SO for examples I am using the code above instead.   </p>
  
  <pre><code>string s =xdoc.Element("UserDefinedSettings").Element("RootFolder").Element("FolderName").Value;
  </code></pre>