Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

Comparing Two Lists in C#.net

$
0
0

Hi All,

I have requirement to Compare two lists.

For Ex: I have created two lists

Class Test

{

String Name;

String Type;

String Region;

String CustomerName;

String IPAddress;

String Values;

};

I have created two lists;

List<Test> Listdata1; List<Test> ListData2;

Listdata1 has 5 lakh records and List2data has 4.5 lakh record.

I need to compare two lists. Each member of each lists i have to do string comparison whether first list member is equal or not with the respective member of second list.

The result i should keep in the third list or in any container which is feasible as shown below:

Result Output be like:

Name   Type    Region   CustomerName   IpAddress       Values     CustomerName   IpAddress            Values

abc1     Male    UnitedAmerica Customer1        10.18.10.252        0.08         Customer1        10.18.10.252     0.9

abc1    Male    UnitedKingdom Customer2   10.18.10.2540.5       Customer3        10.18.10.252     0.76    

abc2    Female    India         Customer3   10.18.10.2420.05Customer510.18.10.245     0.6

abc3     Female    Uk                  Customer4          10.18.20.220       4.5            Customer6       10.18.19.225     12.9

I need to do string compare of each member of two list and somehow i have to  this member is different and this member is same. I have to keep both the list members in the any of the result container. 

Can anyone please give me a good algorithm or feasible solution for the above requirement.

Please give me some good algorithm because it has lakhs of record in both lists. 

You can suggests any other feasible solution also. Whether i can use two lists to compare or is it better to use Two datatables to compare.

Please give me some algorithm.

Thanks & Regards,

Lokesh


Viewing all articles
Browse latest Browse all 1710

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>