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 6348353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:24:11+00:00 2026-05-24T21:24:11+00:00

For a bit of code I am writing, I have a method which checks

  • 0

For a bit of code I am writing, I have a method which checks a new object for similar properties with all existing objects.

This method returns a Dictionary<int, List<int>>. They key is the unique object ID, and the List contains the properties which are similar with the new object. (Constant.Name, Constant.StartDt, etc).

Now, there are several different types of matches which cannot occur. I need a way to compare the various combinations of matches to what is in these lists, and I need to be able to know which match has been matched.

Therefore, I was thinking of creating a List for each match, and comparing each list with the returned property list. However, I know I have done something similar before in Java and it had a flaw – it matched by order…I just need to know if each list CONTAINS these items.

so, two questions:

  1. Is this the best way to find the matches?
  2. If so, what is your suggested method of doing so? Loop through them? Or is there something built in to C# and I am not aware?
  • 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-05-24T21:24:13+00:00Added an answer on May 24, 2026 at 9:24 pm

    You could use the LINQ Intersect method:

    http://msdn.microsoft.com/en-us/library/system.linq.enumerable.intersect.aspx

            int[] id1 = { 44, 26, 92, 30, 71, 38 };
            int[] id2 = { 39, 59, 83, 47, 26, 4, 30 };
    
            IEnumerable<int> both = id1.Intersect(id2);
    
            foreach (int id in both)
                Console.WriteLine(id);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bit of code that looks like this: text = reg.Replace(text, new
I need to integrate some legacy 32-bit code - for which I don't have
This bit of code comes with new classes that are subclasses of UITableViewController... -
I have a bit of code that passes around a ton of objects and
I have written quite a bit of code which uses the Linq2Sql table relationships
This might seem daft for which I'm sorry, I've been writing a bit some
I'm writing a bit of code to display a bar (or line) graph in
I'm having issues with a bit of code that I am writing in C#.
I'm writing a bit of JNI code where a DLL running in the process
This bit of code is taking almost a half second to execute. Could somebody

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.