private static XStreamingElement ToXStreamingElement(DataCenterElement element) { var xElement = new XStreamingElement(element.Name); xElement.Add(element.Attributes.Select(attribute => new XAttribute(attribute.Name, attribute.Value))); xElement.Add(element.Children.Select(ToXStreamingElement)); return(xElement); }
/// <summary> /// Exports the content of the specified element in XML format. /// </summary> /// <param name="element">The element to export.</param> /// <param name="outputPath">The path of the file that will contain the exported content.</param> public static void Export(this DataCenterElement element, string outputPath) { var xElement = ToXStreamingElement(element); using (var file = File.CreateText(outputPath)) { xElement.Save(file); } }