IDictionary<TKey, TValue> vs. IDictionary

Enumerating directly over an IDictionary<TKey,TValue>returns a sequence of  KeyValuePair structs:

public struct KeyValuePair <TKey, TValue>
{
  public TKey Key { get; }
  public TValue Value { get; }
}

Enumerating  over  a  nongeneric  IDictionary returns  a  sequence  of  DictionaryEntry structs:

public struct DictionaryEntry
{   
public object Key { get; set; }   public object Value { get; set; } }

 

posted @ 2013-12-01 16:04  MinieGoGo  阅读(204)  评论(0编辑  收藏  举报