VB.Net. Compare two arrays. Remove those that are duplicated

Hi Experts.   I have two string arrays.   The first is about 1000 the second about 400.   I need to remove from the second array any item that is in the first array.   So I end up with a list of items that are not in the first array.  Any help appreciated.  Many Thanks
LVL 2
PNRTAsked:
Who is Participating?
 
käµfm³d 👽Connect With a Mentor Commented:
If you can use LINQ, then it trivially becomes:

Imports System.Linq

...

Dim result = second.Except(firstArray).ToArray()

Open in new window

0
 
PNRTAuthor Commented:
Hi Thanks for the fast reply.   Is "second" the second array?   Does result become an array?
0
 
käµfm³d 👽Commented:
Yes, and yes. It will be a third array, though.
0
 
PNRTAuthor Commented:
Sounds perfect.  Thanks. I'll run it
0
All Courses

From novice to tech pro — start learning today.