System.Collections.Hashtable.KeyEquals C# (CSharp) Method

KeyEquals() protected method

protected KeyEquals ( Object item, Object key ) : bool
item Object
key Object
return bool
        protected virtual bool KeyEquals(Object item, Object key)
        {
            Debug.Assert(key != null, "key can't be null here!");
            if (Object.ReferenceEquals(_buckets, item))
            {
                return false;
            }

            if (Object.ReferenceEquals(item, key))
                return true;

            if (_keycomparer != null)
                return _keycomparer.Equals(item, key);
            return item == null ? false : item.Equals(key);
        }

Usage Example

Esempio n. 1
0
 // Determine if an item is equal to a key value.
 protected override bool KeyEquals(Object item, Object key)
 {
     // We don't lock this because it does not modify
     // the underlying hash table, or access fields
     // that may be modified by other threads.
     return(table.KeyEquals(item, key));
 }