开发者

LINQ to Object comparing two lists of integer for different values

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

I have two lists of intergers

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?


List2.Except(List1)


var List3 = List2.Except(List1);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜