Пример #1
0
        public override bool Equals(object obj)
        {
            MDictionary <TKey, TValue> other = obj as MDictionary <TKey, TValue>;

            if (other == null || Count != other.Count)
            {
                return(false);
            }
            for (int i = 0; i < Count; i++)
            {
                TKey key = Keys.ElementAt(i);
                if (!other.ContainsKey(key) || !valuesEqualWithOtherMap(key, other))
                {
                    return(false);
                }
            }
            return(true);
        }
Пример #2
0
 private bool valuesEqualWithOtherMap(TKey key, MDictionary <TKey, TValue> other)
 {
     if (typeof(List <string>).IsInstanceOfType(other[key]) && typeof(List <string>).IsInstanceOfType(this[key]))
     {
         List <string> thisList = this[key] as List <string>;
         List <string> list     = other[key] as List <string>;
         if (!thisList.SequenceEqual(list))
         {
             return(false);
         }
     }
     else
     {
         if (!(this[key].Equals(other[key])))
         {
             return(false);
         }
     }
     return(true);
 }