473,387 Members | 1,504 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,387 software developers and data experts.

Comparing 2 arrays, what's the fastest way ?

Hi! I am trying to determine if the DataRow of one dataset contains the same
data as the DataRow of another. I figured I can extract ItemArray's from each
dataset and then compare them.

1) Is this the fastest way? I will have to loop through thousands of rows
for what I am doing.

2) How can I compare arrays for Value Equality ? I do not think array's
..Equal method does Value Equality check. Based on what I understood, it does
Reference Equality check. Am I right ?
Any input is greatly appreciated,

Nov 16 '05 #1
2 6161
Mike <Mi**@discussions.microsoft.com> wrote:
Hi! I am trying to determine if the DataRow of one dataset contains the same
data as the DataRow of another. I figured I can extract ItemArray's from each
dataset and then compare them.

1) Is this the fastest way? I will have to loop through thousands of rows
for what I am doing.
I don't know whether it's worth using ItemArray rather than just
accessing each column in turn - you should benchmark both cases.
2) How can I compare arrays for Value Equality ? I do not think array's
.Equal method does Value Equality check. Based on what I understood, it does
Reference Equality check. Am I right ?


Yes.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
Mike <Mi**@discussions.microsoft.com> wrote:
Hi! I am trying to determine if the DataRow of one dataset contains the same
data as the DataRow of another. I figured I can extract ItemArray's from each
dataset and then compare them.

1) Is this the fastest way? I will have to loop through thousands of rows
for what I am doing.
I don't know whether it's worth using ItemArray rather than just
accessing each column in turn - you should benchmark both cases.
2) How can I compare arrays for Value Equality ? I do not think array's
.Equal method does Value Equality check. Based on what I understood, it does
Reference Equality check. Am I right ?


Yes.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Peter | last post by:
Hi how can I compare two byte arrays in VB.NET Thank Peter
1
by: Iain | last post by:
Hi Hopefully I am missing something really simple with this question, but here goes. I have two Bitarrays that I would like to compare. At the moment, I am XORing one with the other and...
12
by: Elijah Bailey | last post by:
I have two char arrays of size k. I want to know which one is bigger (exactly like for instance I compare two ints/longs/etc.). What is the fastest way to do this? k <= 10 usually for my...
4
by: agent349 | last post by:
First off, I know arrays can't be compared directly (ie: if (arrary1 == array2)). However, I've been trying to compare two arrays using pointers with no success. Basically, I want to take three...
1
by: mdub317 | last post by:
I'm totally new to programming and I am wondering; when would be a good time to use an array or an indexer? I want to know what types of applications would make good use of arrays or indexers. ...
0
by: Mike | last post by:
Hi! I am trying to determine if the DataRow of one dataset contains the same data as the DataRow of another. I figured I can extract ItemArray's from each dataset and then compare them. 1) Is...
3
by: Lance | last post by:
What is the fastest way to determine if two arrays that contain ValueTypes are equal? For example, lets say I have the following: Dim pt1 as New Drawing.Point(1, 2) Dim pt2 as New...
1
by: Donald Grove | last post by:
If I have two arrays, what is a good paradigm for comparing what is in them, to determine what elements they share, or don't share? Specifically, each array could potentially contain the integers...
1
by: psmahesh | last post by:
Hi folks, I am comparing two arrays and removing matches from the second array from the first array. Can someone take a look at this code below and mention if this is okay and perhaps if there...
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: 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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
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...

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.