Difference in HybridDictionary and Generic Dictionary Item behavior if the specified key is not found

In .Net 1.1 I’ve used HybridDictionary.Item and my code expected that if the specified key is not found, attempting to get it returns a null reference.
But in .Net 2.0  Generic Dictionary.Item  if the specified key is not found, a get operation throws a KeyNotFoundException  and I have to use Dictionary.TryGetValue  or check ContainsKey before calling Item.


 

Advertisements