title: How to convert IEnumerable<XElement> to string
body: <p>I have a String that contain some data that i want to manipulate, so i am sending it to a function that does this manipulation.</p>
  <p>I want to return that string after he get manipulates in the function.</p>
  <p>What i manage to to is to return <code>IEnumerable&lt;XElement&gt;</code> from that function that contains the right content after he get manipulate</p>
  <p>I tried to return <code>xmlElements.ToString();</code> from the function but it contained some weird string and not the actual string it self.</p>
  <p><em>renderedOutput= a string in XML structure</em></p>
  <pre><code>var xml = XElement.Parse(renderedOutput);
  IEnumerable&lt;XElement&gt; xmlElements = xml.Descendants();
  </code></pre>
  <p>Then i am sending it to that function (that changes some values)</p>
  <pre><code> xmlElements = SetAdditionalData(xmlElements, docIDs[i], i, orderID);// This is the place where i want to get a String in XML strcture
  </code></pre>
  <p>This just an example of what the function does:</p>
  <pre><code>public IEnumerable&lt;XElement&gt; SetAdditionalData(IEnumerable&lt;XElement&gt; xmlElements, string docID, int i, string orderID)
  {
      foreach (var el in xmlElements)
      {
          // set country name from country iso
          if (el.Name == &quot;Country&quot;)
          {                                      
              var isoC = el.Value.ToString().Trim();
              if (isoC != string.Empty)
              {
                  RegionInfo isoCode = new RegionInfo(isoC);
                  el.SetValue(isoCode.DisplayName);
              }
              continue;                    
          }
      }
  
      return xmlElements;  // tried to return xmlElements.ToSting(), but it didn't returned the right data
  }
  </code></pre>
  <p><strong>I am trying to achieve that:</strong></p>
  <p>xmlElements will contain the string after manipulates - meaning after <code>SetAdditionalData()</code> set some additional data</p>