Comparing 2 arrays, what's the fastest way ?

G

Guest

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,
 
J

Jon Skeet [C# MVP]

Mike said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top