C# – Convert IOrderedEnumerable to XElement

clinqnet

the following linq statement returns a IOrderedEnumerable:

        var list = from e in ritorno.Elements("dossier")
                              orderby e.Element("name")
                              select e;

How can i convert list to XElement?
Thanks

EDIT

list is IOrderedEnumerable<System.Xml.Linq.XElement>

Best Answer

Do you want a single XElement to contain all the elements in the sequence?

XElement element = new XElement("container", list)

(Obviously change "container" to whatever you want the containing element to be called.)

If that's not what you want, please elaborate.