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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:01:13+00:00 2026-05-17T22:01:13+00:00

I asked similar question here , I am wondering how you can achieve same

  • 0

I asked similar question here , I am wondering how you can achieve same result with LINQ

PREVIOUS QUESTION

Compare Dictionary

Rules

Get values from dic2 where key match but values does not match or key is missing in dic2.
Don’t need to iterate through dic2 for missing/different values in dic1.

LINQ CODE

can result and missinkeu can combinstrong texte in one?

private void Compare(SortedDictionary<string, List<foo>> dic1, SortedDictionary<string, List<foo>> dic2)
 {

            var result=   from c in dic1
                          where dic2.ContainsKey((c.Key) && !dic2[c.key]Equals(c.Value)
                          select p.Value;
      

            var missingkey =from c in dic1
                          where !dic2.ContainsKey((c.Key) 
                          select p.Value;
 } 
  • 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-17T22:01:13+00:00Added an answer on May 17, 2026 at 10:01 pm

    Do you just mean:

            var result = from pair in dic1
                         where !dic2.ContainsKey(pair.Key)
                            || !dic2[pair.Key].Equals(pair.Value)
                         select pair.Value;
    

    when the key is there the second match is tested. Note however, that this will only (as written) do a reference test on the lists – it won’t compare individual elements. It is hard to tell if that is what you mean since the code example in the linked post is… “unclear” (in that it attempts to add foo as value for List<foo>).

    If you need to test the individual values:

            var result = from pair in dic1
                         where !dic2.ContainsKey(pair.Key)
                         || !dic2[pair.Key].SequenceEqual(pair.Value)
                         select pair.Value;
    

    (which assumes a sensible Equals implementation on foo.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Liu Chang asked a very similar question to this one here, Linux equivalent of
Similar questions have been asked, but nothing exactly like mine, so here goes. We
I asked a similar question about this previously, but I did not specify that
I have asked a similar question before, but I didn't have a firm grasp
A similar question was already asked ( Performing a Stress Test on Web Application?
A similar question has been asked: MSDN subscriptions on the cheap? , but I
I didn't see any similar questions asked on this topic, and I had to
Similar questions to this one have been asked but none seem to address my
Any recommended crypto libraries for Python. I know I've asked something similar in x509
When asked to create system XYZ and you ask to do it in Python

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.