using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Linq;
public class MainClass {
public static void Main() {
IEnumerable<XElement> elements =new XElement[] {new XElement("Element", "A"),new XElement("Element", "B")};
XElement xElement = new XElement("RootElement", elements.Select(e => (string)e != "A" ? new XElement(e.Name, (string)e) : null));
Console.WriteLine(xElement);
}
}
|