473,385 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Question: How to compare two arrays and remove the identical

Anyone knows how to code this at C# ?
Oct 15 '07 #1
3 10807
JosAH
11,448 Expert 8TB
Anyone knows how to code this at C# ?
This is a C/C++ forum, not a C# forum. I'll move your question to the .NET forum
for you.

kind regards,

Jos
Oct 15 '07 #2
wbosw
36
raiwozen

Here is the VB.Net code for comparing two arrays and removing the item from one array. I didn't have the C# code handy, but you should be able to convert this example without any trouble.


For Each item As String In arraylist 'item one

For Each item2 As String In arraylist2 'l two

Dim res As Int16 = String.Compare(item, item2) ' compare items


If res = 0 Then 'the items are equal

arraylist.Remove(item)
End If

Next
Next



Wbosw
Oct 15 '07 #3
raiwozen

Here is the VB.Net code for comparing two arrays and removing the item from one array. I didn't have the C# code handy, but you should be able to convert this example without any trouble.


For Each item As String In arraylist 'item one

For Each item2 As String In arraylist2 'l two

Dim res As Int16 = String.Compare(item, item2) ' compare items


If res = 0 Then 'the items are equal

arraylist.Remove(item)
End If

Next
Next



Wbosw
Thank you this really helped a lot! ^_^
Oct 15 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: windandwaves | last post by:
is there a quick way to compare the results from two arrays and note the differences? I have two identical tables in MySql (backup and current table) and I want to work out the differences between...
7
by: Squignibbler | last post by:
Hi all, I have a question regarding the C++ programming language regarding the nature of the relationship between pointers and arrays. If the statement MyArray is functionally identical to...
17
by: herrcho | last post by:
#include <stdio.h> int main() { int i; char *p="sarang"; for(i=0;i<4;i++) printf("%c",*(p+i)); printf("\n"); for(i=0;i<4;i++)
4
by: Matt Burland | last post by:
I'm a little confused about the way the default equality operator works with classes. Here's the situation, I have two comboboxes that are each filled with different object (i.e. ComboBox1 contains...
8
by: Turbot | last post by:
Hello, Anyone know how to compare two byte arrays without going through each item in the array. I actually want to compare two bitmap objects to see if they both contain the same picture bit...
21
by: yeti349 | last post by:
Hi, I'm using the following code to retrieve data from an xml file and populate a javascript array. The data is then displayed in html table form. I would like to then be able to sort by each...
4
by: Jim Andersen | last post by:
Is there anything built into .NET that is good (or rather easy) at comparing ? I have some data (in an array). I make a copy of this array, and the user changes some of the data, or maybe he...
3
by: John | last post by:
I have two large arrays. Is there a rapid method to comaprs the two arrays and creat a third array of onlt thos items that the are in the first array but not the second array. I do it manually...
3
by: =?Utf-8?B?UmljY2FyZG8=?= | last post by:
What is the best method to compare 2 array to knw if each element is equal? Now, i have to compare the datarow.itemarray of 2 datarows wich is equals in structure. I tried to write this routine:...
17
by: Suresh Pillai | last post by:
I am performing simulations on networks (graphs). I have a question on speed of execution (assuming very ample memory for now). I simplify the details of my simulation below, as the question I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.