Solved

c# Compare two dictionaries

Posted on 2010-09-02
1
2,422 Views
Last Modified: 2012-08-13
Hi

I have two dictionary object variables
I want to know if they are different or not. I expect them to be totally alike but I want to have a fast check.
What is the fastest way to compare these two dictionaries. I would prefer not having to loop through them

any ideas?
0
Comment
Question by:liversen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 53

Accepted Solution

by:
Dhaest earned 500 total points
ID: 33586014
You can't directly compare the list & the dictionary, but you could compare the list of values from the Dictionary with the list

http://msdn.microsoft.com/en-us/library/bb342073.aspx 

Enumerable.SequenceEqual

Determines whether two sequences are equal by comparing their elements by using a specified IEqualityComparer(T).

found at: http://stackoverflow.com/questions/43500/is-there-a-built-in-method-to-compare-collections-in-c
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Create a Dropdown list with sub group 10 39
.NET Redemption/Outlook Examples 3 25
async questions 5 46
How do you think this website does searches? 5 31
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question