Why doesn't HashTable.Contains() just simply return false if it is passed a null?
- by Nate Pinchot
I understand why passing a null to HashTable.Contains() doesn't work, but I don't understand what the point of it throwing an ArgumentNullException is - instead of just simply returning false? What is the benefit of throwing the exception (other than to make me do null checks before calling .Contains())?
Caused By [System.ArgumentNullException]
Key cannot be null.
Parameter name: key
at System.Collections.Hashtable.ContainsKey(Object key)
at System.Collections.Hashtable.Contains(Object key)