Select case on an object's type in .NET

Published · Last Updated

This is an alternative to converting the type into a string and checking against that.

Select Case msg.GetType()
    Case GetType(ClassA)
    Case GetType(ClassB)
    Case Else
End Select

No comments yet.