LINQ Select distinct from a List?

前端 未结 3 731
不知归路
不知归路 2021-01-18 14:41

I have the following list:


    class Person
    {
        public String Name { get; set; }
        public String LastName { get; set; }
        public Stri         


        
3条回答
  •  再見小時候
    2021-01-18 14:55

    In addition to Darin Dimitrov's answer, here is the same in query syntax:

    var groupByCityQuery = from person in personList 
                           group person by person.City into grouping 
                           select grouping;
    

提交回复
热议问题