A
ahoneytrap
Hello all,
I've been scouring through the source code (reflector, shared source)
of the framework and was looking at the hashtable implementation.
From what I can tell, the default implentation uses an array of Bucket
objects which contain the key and value. Then the hash is calculated
elsewhere to point to the index in the array of buckets.
So hashTable.Add("tree","value") would create a bucket object with
"tree" and "value" which is added to the array (which is resized every
100 entries from what I can see). What I'm wondering is how does it
know where in the array to place the item? I appreciate some kind of
modula is done based on the int hash of "tree", but can anyone be more
precise? I'm interested in how it places it in the array rather than
the hash function itself.
I've been scouring through the source code (reflector, shared source)
of the framework and was looking at the hashtable implementation.
From what I can tell, the default implentation uses an array of Bucket
objects which contain the key and value. Then the hash is calculated
elsewhere to point to the index in the array of buckets.
So hashTable.Add("tree","value") would create a bucket object with
"tree" and "value" which is added to the array (which is resized every
100 entries from what I can see). What I'm wondering is how does it
know where in the array to place the item? I appreciate some kind of
modula is done based on the int hash of "tree", but can anyone be more
precise? I'm interested in how it places it in the array rather than
the hash function itself.