Geeks With Blogs

News My Blog has been MOVED to https://mfreidge.wordpress.com
Michael Freidgeim's OLD Blog My Blog has been MOVED to https://mfreidge.wordpress.com

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.

 

Posted on Wednesday, August 16, 2006 11:38 AM .Net Framework | Back to top


Comments on this post: Difference in HybridDictionary and Generic Dictionary Item behavior if the specified key is not found

# re: Difference in HybridDictionary and Generic Dictionary Item behavior if the specified key is not found
Requesting Gravatar...
Se also more details in Frans Bouma's blog "Dictionary<TKey, TValue> vs. Hashtable() tip" http://weblogs.asp.net/fbouma/archive/2005/12/12/432942.aspx
Left by Michael Freidgeim on Jun 11, 2007 11:57 AM

Your comment:
 (will show your gravatar)


Copyright © Michael Freidgeim | Powered by: GeeksWithBlogs.net