Example #1
0
 public bool Equals(DataKey other)
 {
     if (other == null)
     {
         return(false);
     }
     string[] array     = this._keyNames;
     string[] strArray2 = other._keyNames;
     if ((array == null) && (this._keyTable != null))
     {
         array = new string[this._keyTable.Count];
         this._keyTable.Keys.CopyTo(array, 0);
     }
     if ((strArray2 == null) && (this._keyTable != null))
     {
         strArray2 = new string[other._keyTable.Count];
         other._keyTable.Keys.CopyTo(strArray2, 0);
     }
     if (!DataBoundControlHelper.CompareStringArrays(array, strArray2))
     {
         return(false);
     }
     if ((array != null) && (strArray2 != null))
     {
         foreach (string str in array)
         {
             if (!object.Equals(this[str], other[str]))
             {
                 return(false);
             }
         }
     }
     return(true);
 }
        public bool Equals(DataKey other)
        {
            if (other == null)
            {
                return(false);
            }

            string[] aKeys = _keyNames;
            string[] bKeys = other._keyNames;

            if (aKeys == null && _keyTable != null)
            {
                aKeys = new string[_keyTable.Count];
                _keyTable.Keys.CopyTo(aKeys, 0);
            }

            if (bKeys == null && _keyTable != null)
            {
                bKeys = new string[other._keyTable.Count];
                other._keyTable.Keys.CopyTo(bKeys, 0);
            }

            // Compare the keys array
            bool hasSameKeyNames = DataBoundControlHelper.CompareStringArrays(aKeys, bKeys);

            if (hasSameKeyNames)
            {
                if (aKeys != null && bKeys != null)
                {
                    foreach (string key in aKeys)
                    {
                        if (!Object.Equals(this[key], other[key]))
                        {
                            return(false);
                        }
                    }
                }
                return(true);
            }

            return(false);
        }