开发者

Remove strings from string A that are in array B

开发者 https://www.devze.com 2023-01-26 18:07 出处:网络
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).

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

精彩评论

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