Пример #1
0
 public static bool Equals <TKey, TValue>(IDictionary <TKey, TValue> left, IDictionary <TKey, TValue> right)
 {
     if (left.Count != right.Count)
     {
         return(false);
     }
     using (IEnumerator <KeyValuePair <TKey, TValue> > enumerator = left.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             KeyValuePair <TKey, TValue> current = enumerator.Current;
             TValue tValue;
             if (!right.TryGetValue(current.Key, out tValue))
             {
                 bool result = false;
                 return(result);
             }
             IEnumerable enumerable  = current.Value as IEnumerable;
             IEnumerable enumerable2 = tValue as IEnumerable;
             if (enumerable == null || enumerable2 == null)
             {
                 if (!object.Equals(current.Value, tValue))
                 {
                     bool result = false;
                     return(result);
                 }
             }
             else if (!Enumerables.Equals(enumerable, enumerable2))
             {
                 bool result = false;
                 return(result);
             }
         }
     }
     return(true);
 }