Switch or a Dictionary when assigning to new object
- by KChaloux
Recently, I've come to prefer mapping 1-1 relationships using Dictionaries instead of Switch statements. I find it to be a little faster to write and easier to mentally process. Unfortunately, when mapping to a new instance of an object, I don't want to define it like this:
var fooDict = new Dictionary<int, IBigObject>()
{
{ 0, new Foo()…