Linq extensions to calculate basic statistics