I'm getting this warning but can't figure out the problem...
CodeContracts: warning: The Boolean condition d1.Count != d2.Count always evaluates to a constant value. If it (or its negation) appear in the source code, you may have some dead code or redundant check
The code is as follows:
public static bool DictionaryEquals<TKey, TValue>(IDictionary<TKey, TValue> d1, IDictionary<TKey, TValue> d2)
{
if (d1 == d2) return true;
if (d1 == null || d2 == null) return false;
if (d1.Count != d2.Count) return false; // <-- warning here
// Equality check goes here
return true;
}
The // Equality check goes here
part can be as is, or replaced by a proper implementation and I still get the same warning.