Fastest way to Remove Duplicate Value from a list<> by lambda

前端 未结 7 1942
庸人自扰
庸人自扰 2020-12-01 00:55

what is fastest way to remove duplicate values from a list. Assume List longs = new List { 1, 2, 3, 4, 3, 2, 5 }; So I am interesting in

7条回答
  •  遥遥无期
    2020-12-01 01:03

    There is Distinct() method. it should works.

    List longs = new List { 1, 2, 3, 4, 3, 2, 5 };
    var distinctList = longs.Distinct().ToList();
    

提交回复
热议问题