How to get the Max() of a Count() with LINQ

前端 未结 4 916
面向向阳花
面向向阳花 2021-02-08 20:45

I\'m new to LINQ and I have this situation. I have this table:

ID Date  Range
1 10/10/10 9-10
2 10/10/10 9-10
3 10/10/10 9-10
4 10/10/10 8-9
5 10/11/10 1-2
6 10/         


        
4条回答
  •  后悔当初
    2021-02-08 21:35

    unfortunately I can't test this at the moment but give this a try:

    List items = GetItems();
    items.Max(t=>t.Range.Distinct().Count());
    

提交回复
热议问题