title: How to list xml Element via XDocument in c#?
body: <p>I have read a lot of topics here regarding xml and tried some, but still I can't get work of this problem.<br>
  I have to list the "Items" from my xml file and load it to a ListView. My project is made in Pocket-PC. Here is the sample xml content.  </p>
  
  <pre><code>&lt;? xml version="1.0" encoding="utf-8" ?&gt;
  &lt;Library&gt;
      &lt;Item&gt;
          &lt;Name&gt;Picture&lt;/Name&gt;
          &lt;FullPath&gt;\My Device\My Documents\Picture&lt;/FullPath&gt;
          &lt;SystemFullpath&gt;\Program Files\Explorer\Library&lt;/SystemFullpath&gt;
          &lt;Created&gt;0001-01-01T00:00:00&lt;/Created&gt;
      &lt;/Item&gt;
      &lt;Item&gt;
          &lt;Name&gt;Video&lt;/Name&gt;
          &lt;FullPath&gt;\My Device\My Documents\Video&lt;/FullPath&gt;
          &lt;SystemFullpath&gt;\Program Files\Explorer\Library&lt;/SystemFullpath&gt;
          &lt;Created&gt;0001-01-01T00:00:00&lt;/Created&gt;
      &lt;/Item&gt;
      &lt;Item&gt;
          &lt;Name&gt;File&lt;/Name&gt;
          &lt;FullPath&gt;\My Device\My Documents\File&lt;/FullPath&gt;
          &lt;SystemFullpath&gt;\Program Files\Explorer\Library&lt;/SystemFullpath&gt;
          &lt;Created&gt;0001-01-01T00:00:00&lt;/Created&gt;
      &lt;/Item&gt;
  &lt;/Library&gt;  
  </code></pre>
  
  <p>The way I add an Item:  </p>
  
  <pre><code>public bool AddLibrary(Library lib)
  {
      try
      {
          XDocument xDoc = XDocument.Load(fileName);
          XElement xe = new XElement("Item",
              new XElement("Name", lib.Name),
              new XElement("Fullpath", lib.Fullpath),
              new XElement("SystemFullpath", lib.SystemFullpath),
              new XElement("Created", lib.Created));
  
          xDoc.Element("Library").Add(xe);
          xDoc.Save(fileName);
          return true;
      }
      catch { return false; }
  }  
  </code></pre>
  
  <p>The Library Entity:  </p>
  
  <pre><code>public class Library
  {
      public Library() { }
  
      // Unique
      public string Name { get; set; }
  
      public string Fullpath { get; set; }
  
      public string SystemFullpath { get; set; }
  
      public DateTime Created { get; set; }
  
      public List&lt;Items&gt; Items { get; set; }
  }  
  </code></pre>
  
  <p>And the code for retrieving items that returns an error:  </p>
  
  <pre><code>public List&lt;Library&gt; RetrieveAllLibrary()
  {
      List&lt;Library&gt; libList = new List&lt;Library&gt;();
      if (File.Exists(fileName))
      {
          XDocument xDoc = XDocument.Load(fileName);
  
          var items = from item in xDoc.Descendants("Item")
                      select new
                      {
                          Name = item.Element("Name").Value,
                          FullPath = item.Element("FullPath").Value,
                          Created = item.Element("Created").Value
                      };
  
          if (items != null)
          {
              foreach (var item in items)
              {
                  Library lib = new Library();
                  lib.Name = item.Name;
                  lib.Fullpath = item.FullPath;
                  lib.Created = DateTime.Parse(item.Created);
                  libList.Add(lib);
              }
          }
      }
      return libList;
  }  
  </code></pre>
  
  <p>The error says:  </p>
  
  <p><img src="https://i.stack.imgur.com/qrGs2.png" alt="enter image description here">  </p>
  
  <p>I hope I'd explain it well. Thanks for help!!</p>