Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9009537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:13:25+00:00 2026-06-16T02:13:25+00:00

Possible Duplicate: Compare two Lists for differences I have following set of arrays string[]

  • 0

Possible Duplicate:
Compare two Lists for differences

I have following set of arrays

string[] arr1 = { 1155717, 5184305, 2531291, 1676341, 1916805 ... } 
string[] arr2 = { 1155717, 1440230, 2531291, 8178626, 1916805 ... }
string[] arr3 = { 1155717, 5184305, 4025514, 1676341, ... }

Arrays count is in millions & can contains characters as well.
I want to create a report like this in csv

diff.csv

arr1,arr2,arr3
1155717,1155717,1155717
5184305,--N/A--,5184305
--N/A--,1440230,--N/A--
--N/A--,--N/A--,4025514
1676341,--N/A--,1676341
--N/A--,8178626,--N/A--
1916805,1916805,--N/A--

I guess applying for loops in each & comparing wouldn’t be that good approach.Any Ideas?

Few Things i missed :
1. Order doesnt matter.
2. Elements in a single list will be unique.
3. I plan to skip loops as far as possible & look for .NET 3.5 / 4.0 ‘s new features in LINQ / Generics which I can apply here!

For those voting negatively or closing this question please explain so?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T02:13:26+00:00Added an answer on June 16, 2026 at 2:13 am

    You can use linq to GroupJoin:

    string[] arr1 = { "1155717", "5184305", "2531291", "1676341", "1916805" };
    string[] arr2 = { "1155717", "1440230", "2531291", "8178626", "1916805" };
    string[] arr3 = { "1155717", "5184305", "4025514", "1676341" };
    
    var allPossibleTerms = arr1.Union(arr2).Union(arr3);
    
    allPossibleTerms
        .GroupJoin(arr1, all => all, a1 => a1, (all, a1) => new { Number = all, A1 = a1 })
        .SelectMany(joined => joined.A1.DefaultIfEmpty(), (collection, result) => new { collection.Number, A1 = result})
        .GroupJoin(arr2, joined => joined.Number, a2 => a2, (collection, a2) => new { Number = collection.Number, A1 = collection.A1, A2 = a2 })
        .SelectMany(joined => joined.A2.DefaultIfEmpty(), (collection, result) => new { collection.Number, A1 = collection.A1, A2 = result})
        .GroupJoin(arr3, joined => joined.Number, a3 => a3, (collection, a3) => new { Number = collection.Number, A1 = collection.A1, A2 = collection.A2, A3 = a3 })
        .SelectMany(joined => joined.A3.DefaultIfEmpty(), (collection, result) => new { collection.Number, A1 = collection.A1, A2 = collection.A2, A3 = result});;
    

    Basically, this creates a master-list of all terms, and joins each array as it goes.

    ╔══════════════════════════════════════╗
    ║ Number   A1       A2       A3        ║
    ╠══════════════════════════════════════╣
    ║ 1155717  1155717  1155717  1155717   ║
    ║ 5184305  5184305  -------  5184305   ║
    ║ 2531291  2531291  2531291  -------   ║
    ║ 1676341  1676341  -------  1676341   ║
    ║ 1916805  1916805  1916805  -------   ║
    ║ 1440230  -------  1440230  -------   ║
    ║ 8178626  -------  8178626  -------   ║
    ║ 4025514  -------  -------  4025514   ║
    ╚══════════════════════════════════════╝
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Java Compare Two Lists If I have two ordered sequences of numbers
Possible Duplicate: PHP compare array I have to compare two arrays in php and
Possible Duplicate: Using jQuery to compare two arrays I have to send the form
Possible Duplicate: How to compare two arraylist? I have two String ArrayLists of different
Possible Duplicate: Differences in string compare methods in C# In .NET there are many
Possible Duplicate: When are two enums equal in C#? I have the following classes
Possible Duplicate: In Perl, is there a built in way to compare two arrays
Possible Duplicate: How to compare two hashmaps in java? Hi i have two different
Possible Duplicate: Using jQuery to compare two arrays I need a Javascript or jQuery
Possible Duplicate: Compare dates in java I am getting two dates from server in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.