// Collection of code snippets by Arne Vajhøj // posted to eksperten.dk, usenet and other places (2002-now) using System; using System.Data; public class MainClass { public static void Main(string[] args) { DataSet ds = new DataSet(); ds.ReadXmlSchema(@"C:\ds.xsd"); ds.ReadXml(@"C:\ds.xml"); int count = (int)ds.Tables[0].Compute("COUNT(value)",""); long sum = (long)ds.Tables[0].Compute("SUM(value)",""); long avg = (long)ds.Tables[0].Compute("AVG(value)",""); Console.WriteLine(count + " " + sum + " "+ avg); } }