I have two lists:
List listA
List listB
How to check using LINQ if in the listA
exists an element w
List has Contains method that return bool. We can use that method in query.
List listA = new List();
List listB = new List();
listA.AddRange(new int[] { 1,2,3,4,5 });
listB.AddRange(new int[] { 3,5,6,7,8 });
var v = from x in listA
where !listB.Contains(x)
select x;
foreach (int i in v)
Console.WriteLine(i);