0
kicks
An Elegant Way to Implement ReadOnlyDictionary<TKey, TValue> in C#
While working on creating an application framework for a personal project, I needed a way to expose a Dictionary<TKey, TValue> object from one of my methods. The only caveat being, I wanted the Dictionary object to be read-only. I knew that there exists a ReadOnlyCollection<T> in the FCL, but to my dismay there is no built-n way of creating a read-only Dictionary in .NET.