我很好奇它怎么可能ReadOnlyDictionary
实现IDictionary
,ICollection
但它没有公开方法Add(TKey key, TValue value)
ReadOnlyDictionary<object, object> dictionary;
dictionary.Add(null, null); // compilation error
IDictionary<object,object> i;
i = dictionary;
i.Add(null, null);// no compilation error