Today I was discussing with another developer about a limitation in a third party library, where we couldn t use spaces in a string. The reasoning was that the strings were used as keys in a .NET Hashtable, and that searching a .NET HashTable was significantly slower when the keys contained spaces.
Now since I m too lazy to write a test, but I still want to understand why this would be so, I ask my question here:
Is it slower to search a Hashtable when the string that is used contains a space?
I would not expect this, since before the search is performed, the hash is obtained using String.GetHashCode() and then that hash is used to locate the entry in the table.
Thanks!