LINQ query to find if items in a list are contained in another list

前端 未结 9 473
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-01 00:14

I have the following code:

List test1 = new List { \"@bob.com\", \"@tom.com\" };
List test2 = new List

        
9条回答
  •  萌比男神i
    2020-12-01 00:42

    No need to use Linq like this here, because there already exists an extension method to do this for you.

    Enumerable.Except

    http://msdn.microsoft.com/en-us/library/bb336390.aspx

    You just need to create your own comparer to compare as needed.

提交回复
热议问题