LINQ Split list into lists by date

c#, linq, list

Solution

`DateTime` has a `Date` property:

List<List<Payments>> result = payments 
    .GroupBy(p => p.PaymentDate.Date)
    .Select(g => g.ToList())
    .ToList();

Problem

I have list of objects `List<Payment>`. I would like to get list of lists grouped by `PaymentDate`. Something like that: `List<List<Payments>>` where each list of the list have same date (without hours).

Original source