How can you retrieve the Hashtable's load factor?

John Zukowski

There is no public interface to access the load factor setting.

Some choices you can do to expose this value...

  • Subclass Hashtable and add a read-only accessor method
  • Use reflection to access the private field (only possible in trusted environment)
  • Serialize the Hashtable and get the value from the stream (when reading back the stream, you'll have to figure out where the appropriate field is)