I have a LINQ-to-SQL query that runs through a table, that I want to select 3 sum s - the sums of Rate and AdditionalCharges , so I have something like this:
var sums = from d in dc.Deliveries
where d.TripDate == DateTime.Now
select new
{
Rate = d.Rate,
AdditionalCharges = d.AdditionalCharges
};
然而,这显然使每次交付都翻了一番,这意味着我不得不在之后加起来——这似乎效率不高。 是否有较容易的办法?