I have a fairly simple case that I started solving with foreach (), but then I thought I could do it with Linq.
Basically, I have an IList containing PaymentTransaction objects, and there are 2 Dealer and Amount properties.
I want GroupBy() on Dealer and Sum() on Amount .
I tried to execute this using the following code, but unfortunately it does not work:
var test = paymentTransactionDao.GetAll().GroupBy(x => x.Dealer).Sum(x => x.Amount);
What exactly am I doing wrong here?
source share