From Xojo Documentation

Property (As Integer )
aDictionary.BinCount = newIntegerValue
IntegerValue = aDictionary.BinCount

Supported on Desktop, Web, Console.

The number of bins the hash table uses. This is a measure of the hash table size, independent of the number of items the Dictionary contains.


Normally, you do not need to be concerned with bins and the hash table. BinCount would be of use to you only if you have very large dictionaries consisting of thousands of entries and you want to try to optimize performance.

If you set BinCount to a positive value, the Dictionary will use that number of bins regardless of the number of items in the Dictionary.

If you set BinCount to a value equal to or less than zero, the Dictionary will pick whatever value it thinks is appropriate for the number of items in the dictionary. It will dynamically change the number of bins as items are added or removed from the Dictionary (or until you assign a positive value to BinCount).

The latter is the default behaviour.

Sample Code

This example sets the number of bins:

Var d As New Dictionary
d.BinCount = 100