During my previous software development project, I found that the handling of heterogeneous collections was one of the most interesting development problems. Because there are many possible solutions whose validity depends mostly on your more general problem, this issue is very representative of software design in general: making the best choices and finding the best compromise for a given set of constraints.

In this article, I will focus on a very specific problem: designing a C# interface for an easy read/write access to a list of settings. This list is not fixed and depends on the implementation class, but as part of a more general API, the interface must also be quite secure, especially in terms of type casting.