Exemple #1
0
        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);
        }
Exemple #2
0
        /// <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);
            }
        }