I have a linq query, that gets data from a table in a DataContext object. One of the columns in this table has a Datatype of float. I would like to get the total of that specific column. How could I go about doing this?
+2
A:
var sum = context.Foos.Sum(foo => foo.Bar);
... assuming an entity type named Foo
with a numerical column named Bar
.
Daniel Brückner
2010-05-14 09:26:13