示例#1
0
        public string ToXml()
        {
            // using LINQ to save to Xml
            // create an "inner" element to hold
            // the list of Grouping variables
            // could be 0 or more
            XElement groups = new XElement("GroupVariables");

            foreach (string var in VariableGroups)
            {
                groups.Add(new XElement("GroupVariable", var));
            }

            XDocument doc = new XDocument(
                new XDeclaration("1.0", "utf-8", string.Empty),
                new XElement("RunningTotalsTask",
                             new XElement("Version", version),
                             new XElement("FilterSettings", FilterSettings.ToXml()),
                             new XElement("DataOut", DataOut),
                             new XElement("MeasureVar", VariableMeasure),
                             new XElement("TotalsVar", VariableTotal),
                             groups
                             )
                );

            return(doc.ToString());
        }