Hi all,
What is the best way to compare 2 (large) ArrayLists filled with an object.
Can you please help me?
Gaby 4 7580
Hi,
What you mean with "filled with an object" ?
If the array is of a user defined type I th ink that first it depend of how
you want it to compare them, you could compare if both arrays have the same
references, if so all you have to do is a foreach.
If you want to compare the objects itself it depend of the class.
Also remember to check for the size to be equal.
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Gaby" <Ga**@discussio ns.microsoft.co m> wrote in message
news:34******** *************** ***********@mic rosoft.com... Hi all,
What is the best way to compare 2 (large) ArrayLists filled with an object. Can you please help me?
Gaby
Hi,
I need to compare 2 array lists with the same object type (cAddress).
public class cAddress
{
public string Address = "";
public string Number = "";
public string Zip = "";
public string City = "";
public string Country = "";
public string Telephone = "";
}
Every period the data from the database will be checked against the current
arraylist.
The lists will be filled with aprox 10000 objects.
No I want to know what the best and quickest way is.
Gaby
"Ignacio Machin ( .NET/ C# MVP )" wrote: Hi,
What you mean with "filled with an object" ?
If the array is of a user defined type I th ink that first it depend of how you want it to compare them, you could compare if both arrays have the same references, if so all you have to do is a foreach.
If you want to compare the objects itself it depend of the class.
Also remember to check for the size to be equal.
cheers,
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "Gaby" <Ga**@discussio ns.microsoft.co m> wrote in message news:34******** *************** ***********@mic rosoft.com... Hi all,
What is the best way to compare 2 (large) ArrayLists filled with an object. Can you please help me?
Gaby
First step, make cAddress objects comparable. Basically, this means to
implement the IComparable interface (that is, define a CompareTo method for
it). You may also wnat to define an operator== for it.
Next, I'm going to assume that Current[i] corresponds to Database[i], in
which case it, it's just:
for(int i =0; i< Current.Length, ++i)
{
cAddress ad1 = Current[i];
cAddress ad2 = Database[i];
if (ad1.CompareTo( ad2) != 0)
return "Don't Match";
}
return "Match";
--
--
Truth,
James Curran
[erstwhile VC++ MVP]
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
"Gaby" <Ga**@discussio ns.microsoft.co m> wrote in message
news:BA******** *************** ***********@mic rosoft.com... Hi,
I need to compare 2 array lists with the same object type (cAddress). public class cAddress { public string Address = ""; public string Number = ""; public string Zip = ""; public string City = ""; public string Country = ""; public string Telephone = ""; }
Every period the data from the database will be checked against the
current arraylist. The lists will be filled with aprox 10000 objects. No I want to know what the best and quickest way is.
Gaby "Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,
What you mean with "filled with an object" ?
If the array is of a user defined type I th ink that first it depend of
how you want it to compare them, you could compare if both arrays have the
same references, if so all you have to do is a foreach.
If you want to compare the objects itself it depend of the class.
Also remember to check for the size to be equal.
cheers,
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "Gaby" <Ga**@discussio ns.microsoft.co m> wrote in message news:34******** *************** ***********@mic rosoft.com... Hi all,
What is the best way to compare 2 (large) ArrayLists filled with an object. Can you please help me?
Gaby
cheers....
"James Curran" wrote: First step, make cAddress objects comparable. Basically, this means to implement the IComparable interface (that is, define a CompareTo method for it). You may also wnat to define an operator== for it.
Next, I'm going to assume that Current[i] corresponds to Database[i], in which case it, it's just:
for(int i =0; i< Current.Length, ++i) { cAddress ad1 = Current[i]; cAddress ad2 = Database[i]; if (ad1.CompareTo( ad2) != 0) return "Don't Match"; } return "Match";
-- -- Truth, James Curran [erstwhile VC++ MVP]
Home: www.noveltheory.com Work: www.njtheater.com Blog: www.honestillusion.com Day Job: www.partsearch.com
"Gaby" <Ga**@discussio ns.microsoft.co m> wrote in message news:BA******** *************** ***********@mic rosoft.com... Hi,
I need to compare 2 array lists with the same object type (cAddress). public class cAddress { public string Address = ""; public string Number = ""; public string Zip = ""; public string City = ""; public string Country = ""; public string Telephone = ""; }
Every period the data from the database will be checked against the current arraylist. The lists will be filled with aprox 10000 objects. No I want to know what the best and quickest way is.
Gaby "Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,
What you mean with "filled with an object" ?
If the array is of a user defined type I th ink that first it depend of how you want it to compare them, you could compare if both arrays have the same references, if so all you have to do is a foreach.
If you want to compare the objects itself it depend of the class.
Also remember to check for the size to be equal.
cheers,
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "Gaby" <Ga**@discussio ns.microsoft.co m> wrote in message news:34******** *************** ***********@mic rosoft.com... > Hi all, > > What is the best way to compare 2 (large) ArrayLists filled with an > object. > Can you please help me? > > Gaby This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tom Szabo |
last post by:
Just wandering how can you close a browser remotely. In some web
applications the browser closes or refreshes periodically.
How is that done and how can it be done through PHP?
TIA,
Tom
|
by: Reid Nichol |
last post by:
Hello,
I was wondering if I could control how many bytes are in an int and
the byte order. In C/C++ I can use int32 but how do I do this in
python? How can I control byte order?
|
by: v I n O |
last post by:
hI Geeks
Please do let me know how do i find how many instances sql server
running on the single machine. or in the n/w my objective should with
help of C#/vb.net
|
by: James Salisbury |
last post by:
Hi,
I was checking my parent's website salisbury.cabrera.net on google by
entering villa rent spain cabrera I can see the required site, ranked at 4,
but I am concerend by the return at 1 and 5 in the list. Any ideas why
somone else may be using the text from my site, and how can I make an abuse
report?
Thanks
|
by: Frances Del Rio |
last post by:
http://www.emol.com/especiales/cocina_chilena/comida.asp
this page is so neat (goes in pop-up..) how was this done? how do you
give a layer (or div, I guess) a semi-transparency so you can still
see img under it? (and how do you do the scroll for the div?) I know
HTML very well, I also CSS and JavaScript, but am a bit mystified
here...
PLEASE respond by e-mail, fdr58@yahoo.com, my access to usenet is very
limited.. thank you..
| |
by: |
last post by:
Developing, building, and testing. How do it the best? Learning from the
world leader - Microsoft
I'm very interested in how the developing/build/testing workflow @ Microsoft
looks like. I think Microsoft as world leader in software developing
business must have a very good workflow. Does anyone know how the
development flow @ Microsoft looks like?
|
by: Supra |
last post by:
in vb6
listbox1.remove item 5
how will i do in vb.net?
regards
|
by: anushhprabu |
last post by:
#define q(k)main(){ return!puts(#k"\nPRABUq("#k")");}
q(#define q(k)main(){return!puts(#k"\nq("#k")");})
guys i'm working on this code.. i got it fromnet.. how this is working.. anyone pls.. it is printing the same content on screen.. how ya.. how it is.. how how how??
please...................
|
by: candra |
last post by:
Learn What Hackers Know?
-General Hacking Information
-Password Security
-Scanning, Fingerprinting And Similar Techniques
-How Hackers Attack Numerous Internet Services
-How Hackers Attack Web Servers, Cgis, PHP, ASP, Etc
-How Hackers Attack IRC, Instant Messaging, And Multiplayer Games
-Vulnerabilities Found In Platforms With Smaller Market Share
-How Hackers Attack Novell And Networks
|
by: belred |
last post by:
i just read this blog about how many objects (types) are loaded for a
hello world program in C#.
http://blogs.msdn.com/abhinaba/archive/2008/09/15/how-many-types-are-loaded-for-hello-world.aspx
how can you find out how many are loaded for a python program: print
'hello'
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |