Get distinct list values

后端 未结 8 875
余生分开走
余生分开走 2020-12-17 17:58

i have a C# application in which i\'d like to get from a List of Project objects , another List which contains distinct objects.

i trie

8条回答
  •  甜味超标
    2020-12-17 18:38

    var newList = 
    (
    from x in model
    select new {Id_user= x.Id_user}
    ).Distinct();
    

    or you can write like this

    var list1 = model.DistinctBy(x=> x.Id_user);
    

提交回复
热议问题