I have two Generic Dictionaries.Both have same keys.But values can be different.I want to compare 2nd dictionary with 1st dictionary .If there are differences between values
Assuming both dictionaries have the same keys, the simplest way is
var result = a.Except(b).ToDictionary(x => x.Key, x => x.Value);
EDIT
Note that a.Except(b) gives a different result from b.Except(a):
a.Except(b)
b.Except(a)
a.Except(b): Price 20 b.Except(a): Price 40