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
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
It’s quite interesting for me as I worked with Excel using for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Sending a Secure fax is easy with eFax Corporate ( First, just open a new email message. In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

815 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now