Finding the difference between two lists of strings

前端 未结 3 1439
挽巷
挽巷 2021-01-21 07:02

I\'m pretty sure this is a duplicate, but I have tried everything, and I still cannot seem to get the differences. I have two lists of strings: listA and listB. I\'m trying to

3条回答
  •  有刺的猬
    2021-01-21 07:43

    listA.Except(listB).ToList();
    

    should give the correct answer, but

    set.SymmetricExceptWith(listB);
    

    should not. SymmetricExcept will give the items in listA not in listB plus the items in ListB not in ListA.

提交回复
热议问题