I want to find the fastest way to get the min and max of a column in a table with a single Linq to SQL roundtrip. So I know this would work in two roundtrips:
I'm not sure how to translate it into C# yet (I'm working on it)
This is the Haskell version
minAndMax :: Ord a => [a] -> (a,a) minAndMax [x] = (x,x) minAndMax (x:xs) = (min a x, max b x) where (a,b) = minAndMax xs
The C# version should involve Aggregate some how (I think).
Aggregate