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

Posted on 2013-06-05
Last Modified: 2013-06-05
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
Question by:PNRT
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 75

Accepted Solution

käµfm³d   👽 earned 500 total points
ID: 39223285
If you can use LINQ, then it trivially becomes:

Imports System.Linq


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

Open in new window


Author Comment

ID: 39223296
Hi Thanks for the fast reply.   Is "second" the second array?   Does result become an array?
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39223302
Yes, and yes. It will be a third array, though.

Author Comment

ID: 39223309
Sounds perfect.  Thanks. I'll run it

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit If you want to manage em…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below.…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question