Permalink
Browse files

Merge pull request #157 from CV1/patch-2

Update src/FluentNHibernate/MappingModel/EqualityExtensions.cs
  • Loading branch information...
jagregory committed Aug 17, 2012
2 parents 705a055 + 06c20b7 commit 7d55aae96cc5a9888643b5c111e48f78c0868156
Showing with 7 additions and 6 deletions.
  1. +7 −6 src/FluentNHibernate/MappingModel/EqualityExtensions.cs
@@ -7,16 +7,17 @@ public static class EqualityExtensions
{
public static bool ContentEquals<TKey, TValue>(this IDictionary<TKey, TValue> left, IDictionary<TKey, TValue> right)
{
- if (left.Count() != right.Count())
+ if (left.Count != right.Count)
return false;
- var index = 0;
foreach (var item in left)
{
- if (!item.Equals(right.ElementAt(index)))
- return false;
-
- index++;
+ var leftValue = item.Value;
+ TValue rightValue;
+ if (!right.TryGetValue(item.Key, out rightValue))
+ return false; // Key mismatch
+ if (!Equals(leftValue, rightValue))
+ return false; // Value mismatch
}
return true;

0 comments on commit 7d55aae

Please sign in to comment.