#engineering #dotnet

idea

Dictionary and HashTable are both implementation of IDictionary.

Dictionary maintains order, so values are iterable in $O(n)$. Provides better performance than HashTable on value types[2].

HashTable are weakly typed. Should not be used, instead use Dictionary[3]. Return null on key doesn't exist. Requires boxing, i.e. casting to and from object, which is computationaly expensive for value types (20x factor rather than reference assignment[1]) that need conversion to objects.

references

[1]: # .NET Performance Tips

[2]: # Hashtable and Dictionary Collection Types

[3]: # Hashtable Class