标签:
There are some difference between KeyValuePair which is the generic version and DictionaryEntry which is non generic version.
Dictionary<string, int> dict = new Dictionary<string, int>(); foreach (KeyValuePair<string, int> item in dict) { int i = item.Value; } Hashtable hashtable = new Hashtable(); foreach (DictionaryEntry item in hashtable) { // Cast required because compiler doesn‘t know it‘s a <string, int> pair. int i = (int) item.Value; }
KeyValuePair VS DictionaryEntry
标签:
原文地址:http://www.cnblogs.com/dennysong/p/5621277.html