Solved

c# Compare two dictionaries

Posted on 2010-09-02
1
2,304 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
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Exit the loop 4 43
Coding C# in Linux 8 71
In SQL Server 2016, can we configure MASKing rules that applies for application level users ? 12 58
Hey!! 5 33
Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

832 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