Remove duplicates from a List in C#

前端 未结 27 2390
广开言路
广开言路 2020-11-22 04:41

Anyone have a quick method for de-duplicating a generic List in C#?

27条回答
  •  天命终不由人
    2020-11-22 05:33

    This takes distinct (the elements without duplicating elements) and convert it into a list again:

    List myNoneDuplicateValue = listValueWithDuplicate.Distinct().ToList();
    

提交回复
热议问题