Romhack.Net, the alternative IT magazine

To content | To menu | To search

Keyword - C sharp

Entries feed

C# generics vs. code analysis

A few days ago, I published an article on heterogeneous collections in C#, proposing various possibilities to solve this problem given a specific set of constraints. My final pick was using generics, the built-in template feature of C#. But what the story did not say is that this solution triggers a code analysis warning at compile-time...

Continue reading...

Heterogeneous collections in C#

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.

Continue reading...