Read-Only Collections ^2

.NET already provides a read-only collection type with its
System.Collections.Generic.ReadOnlyCollection<T>, but it’s
just a single class, deceivingly named like a collection when it is actually
wrapping and exposing an IList<T>:

I wasn’t quite happy with that. There are cases when you want to expose an
ICollection<T> as read-only and copying the whole shebang into
a list would be a waste of time and resources. So I spent some time implementing
my own set of read-only collections, each one fully implementing all standard
.NET collection interfaces – no corners cut:

ReadOnlyCollection<T> and ReadOnlyList<T>

Exactly what their names say, read-only wrappers for the ICollection<T>
and IList<T> interfaces.

ReadOnlyDictionary<K, T> and ReadOnlySet<K>

Again, no surprise, these are read-only wrappers for the IDictionary<K, T>
and ISet<K> interfaces.