Select Case on an object's Type in VB.Net

Posted by mcjabberz on Stack Overflow See other posts from Stack Overflow or by mcjabberz
Published on 2009-08-19T18:43:47Z Indexed on 2010/05/15 1:44 UTC
Read the original article Hit count: 319

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 csae.

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about switch-statement