3
Answers

How to find the max after I found a total of the amount

Roelof

Roelof

4y
452
1
Hello,
 
I have this method :

public void MaxMoneySoldInaHour(List<Transaction> transactions)
        {
            var answer = transactions.
                GroupBy(i => i.TimeWhenSold.Hour).
                Select(group => new { Hour = group.Key, Count = group.Sum(i => i.TotalPrice)}).
                ToList();
               

            //TransactionCVSParser.WriteOutComeMoney(answer);
        }
    }
 
but I try to find the  max of the sum calculated by the select. 
 
How can I make that work ?
 
Roelof
Answers (3)