views:

96

answers:

2

I accept both C# and VB.NET suggestion, even though I'm writing an app in VB.NET

I have two lists of intergers

  • List1 {1,2,3,5}
  • List2 {2,4,6,7}

I want to have new List3 {4,6,7} which is composed of elements of List2 that are not in List1. I know I can write a nice For Each loop for this but I want it done in LINQ I've been looking for such methods at Enumerable Methods, but I can't find it.

Is there any way to do with LINQ?

+6  A: 
List2.Except(List1)
Joachim VR
+2  A: 
var List3 = List2.Except(List1);
sblom