Question

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?

Was it helpful?

Solution

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)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top