看着System.Collections.Generic.Dictionary<TKey, TValue>
,它清楚地实现了ICollection<KeyValuePair<TKey, TValue>>
,但没有所需的“void Add(KeyValuePair<TKey, TValue> item)
”函数。C#:如何在没有添加(KeyValuePair <K,V>)的情况下实施ICollection <KeyValuePair <K,V>>的字典<K,V>?
这也可以尝试初始化一个Dictionary
这样,当看到:
private const Dictionary<string, int> PropertyIDs = new Dictionary<string, int>()
{
new KeyValuePair<string,int>("muh", 2)
};
其失败
的方法 '添加' 没有重载采用 '1' 的论点
这是为什么呢?
{new KeyValuePair(“muh”,2)} –
prabhakaran
2014-03-21 05:58:14