Trying to get distinct values from two List objects

后端 未结 6 859
Happy的楠姐
Happy的楠姐 2020-12-18 00:47

I have 2 List objects:

List lst1 = new List();
List lst2 = new List();

Let\'s say they have val

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-18 01:22

    In Linq:

    var distinct = lst2.Contact(lst1).Distinct().ToList();
    

    (Your explanation appears to say that you want the unique elements in both lists. But your example appears that you want the union of both lists).

提交回复
热议问题