简体   繁体   中英

Under what circumstances _buckets[bucketNumber].key == _buckets && ((_buckets[bucketNumber].hash_coll & unchecked(0x80000000)) == 0)) in Hashtable

https://source.dot.net/#System.Private.CoreLib/Hashtable.cs 代码

Under what conditions will this logic be executed that _buckets[bucketNumber].key == _buckets && ((_buckets[bucketNumber].hash_coll & unchecked(0x80000000)) == 0))

The key is set to _buckets when that bucket once contained an entry and it is a collision in Remove

Reading the comment it's pretty clear: if the bucket exists and has no other value inside (ie if it was never used), or if there was a single value (no collision) and was later removed, thus leaving the bucket empty.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM