The aggregate allows you to avoid listing the rows twice (you can get the number of rows from the collection of rows, but this is more to show how to extract multiple aggregates in 1 pass):
var sumAndCount = table.AsEnumerable().Aggregate(new { Sum = 0d, Count = 0}, (data, row) => new { Sum = data.Sum + row.Field<double>("amount"), Count = data.Count + 1}); double sum = sumAndCount.Sum; int count = sumAndCount.Count;
source share