Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否有不支持删除键值对的 IDictionary 接口?
不幸的是,IReadOnlyDictionary它没有帮助,因为它不允许修改键值对。
IReadOnlyDictionary
如果没有,什么是自己实施的好方法?这甚至是个好主意吗?
在评论指出 .NET 中没有内置接口之后,最好创建自己的接口并使用 .NET 的适配器实现它Dictionary<TK,TV>。
Dictionary<TK,TV>
(如果没有更好的结果,我将在两天内接受我自己的答案)