I'm not sure if this valid C#, but hopefully you get the idea. :)
switch (msg.GetType()) {
case ClassA:
// blah
case ClassB:
// blah 2
case ClassC:
// blah 3
}
How would I switch on an object's type but using VB.NET's Select Case
?
I'm aware that some might suggest using polymorphism, but I'm using a hierarchy of small message classes so that really wouldn't work in my case.
If
/ElseIf
s. Kinda sucks that there's not a switch-like way to do it. – Buddhism