title: C# Read XML Element and Text
body: <p>I'm still getting to grips with C# and I've been looking for ages to try and find a solution to my problem. (This is a practice project to help me learn C#)</p>
  
  <p>I am able to create and write to a XML Settings file but I'm struggling getting the data from it.</p>
  
  <p>I tried using the top answer from <a href="https://stackoverflow.com/questions/670563/linq-to-read-xml">here</a> but it didn't work.</p>
  
  <p>I would like to get both the element and inner text from the XML file and into a 2 columned list (I'm currently using a dictionary and I'm open to change this if I have/need to)</p>
  
  <p>In the first column I'd like the element name, and the second, the inner text.</p>
  
  <p>I would then simply just like to write out the list I've created</p>
  
  <p>XML</p>
  
  <pre><code>&lt;settings&gt;
      &lt;view1&gt;enabled&lt;/view1&gt;
      &lt;view2&gt;disabled&lt;/view2&gt;
  &lt;/settings&gt;
  </code></pre>
  
  <p>C#</p>
  
  <pre><code>private Dictionary&lt;string, string&gt; settingsList = new Dictionary&lt;string, string&gt;();
  
  private void CreateSettings()
  {
      XDocument xmlSettings = new XDocument(
          new XElement(
              "settings",
              new XElement("view1", "enabled"),
              new XElement("view2", "disabled")))
  
      xmlSettings.Save(FilePath);
  }
  
  private void ReadSettings
  {
      XDocument xmlSettings = XDocument.Load(FilePath);
  
      //READ XML FROM FILE PATH AND ADD TO LIST
  }
  </code></pre>