Is there an IDictionary interface which does not support removal of Key-Value pairs?

Unfortunately, IReadOnlyDictionary does not help as it does not allow to modify the Key-Value pairs.

If not, what's a good way to implement one myself? Is this even a good idea?

有帮助吗?

解决方案

After the comments indicated that there is no built-in interface in .NET, it is probably best to create my own interface and implement it with an adapter to Dictionary<TK,TV>.

(if nothing better comes up, I'm going to accept my own answer in two days time)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top