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

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

I have the following code:

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

        
9条回答
  •  暖寄归人
    2020-12-01 00:44

    bool doesL1ContainsL2 = l1.Intersect(l2).Count() == l2.Count;
    

    L1 and L2 are both List

提交回复
热议问题