C# switch on type [duplicate]
Update: This got fixed in C# 7.0 with pattern matching switch (MyObj) case Type1 t1: case Type2 t2: case Type3 t3: Old answer: It is a hole in C#’s game, no silver bullet yet. You should google on the ‘visitor pattern’ but it might be a little heavy for you but still something you should … Read more