开发者

Remove strings from string A that are in array B

I have array A and Array B , I want to get as result A\B (to get only the strings that in A but not in B).

Of course I can d开发者_如何学JAVAo two for loops and do it , but is there some more nice way to do so ?

Thanks for help , i use .net3.5


You can use LINQ:

var difference = A.Except(B);

This uses a HashSet and will be substantially faster than nested for loops for large sets.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜