title: Linq to xml portion of XElement
body: <p>I am using Linq to XML to save a List into XML string.</p>
  
  <p>The xml string I am trying to get:</p>
  
  <pre><code>&lt;people&gt;
  &lt;name&gt;xxx&lt;/name&gt;
  &lt;age&gt;23&lt;/age&gt;
  &lt;/people&gt;
  &lt;people&gt;
  &lt;name&gt;yyy&lt;/name&gt;
  &lt;age&gt;25&lt;/age&gt;
  &lt;/people&gt;
  </code></pre>
  
  <p>C# code:</p>
  
  <pre><code>List&lt;Peoples&gt; peopleList = new List&lt;Peoples&gt;(); 
  peopleList.Add(new Peoples() { Name = "xxx", Age = 23 });
  peopleList.Add(new Peoples() { Name = "yyy", Age = 25 });
  var people (from item in peopleList
  select new XElement("people",
                                  new XAttribute("name", item.Name),
                                  new XAttribute("age", item.Age)
                              ));
  </code></pre>
  
  <p>How can I convert <code>var people</code> into <code>XML string</code>?</p>
  
  <p>Thank you.</p>
  
  <hr>
  
  <p>Edited :</p>
  
  <p>What I can think of is to add a root element  into the xml, and replace  and   with empty string.</p>
  
  <hr>
  
  <p>Jignesh Thakker solution works:</p>
  
  <pre><code>string str = people.Select(x =&gt; x.ToString()).Aggregate(String.Concat); 
  </code></pre>