Are there any general performance guidlines for when to use a Case
instead of a chain of ElseIf
?
Please consider the following example...
Dim lobjExample As Object = GetARandomDataTypeCrapExample()
If lobjExample Is GetType(Boolean) Then
' Solve world hunger here
ElseIf lobjExample Is GetType(Byte) Then
' Solve world hunger here
ElseIf lobjExample Is GetType(Char) Then
' Solve world hunger here
ElseIf lobjExample Is GetType(Date) Then
' Solve world hunger here
ElseIf lobjExample Is GetType(Decimal) Then
' Solve world hunger here
ElseIf lobjExample Is GetType(String) Then
' Solve world hunger here
ElseIf lobjExample Is GetType(Integer) Then
' Solve world hunger here
ElseIf lobjExample Is GetType(Double) Then
' Solve world hunger here
ElseIf lobjExample Is GetType(Long) Then
' Solve world hunger here
ElseIf lobjExample Is GetType(SByte) Then
' Solve world hunger here
ElseIf lobjExample Is GetType(Short) Then
' Solve world hunger here
ElseIf lobjExample Is GetType(Single) Then
' Solve world hunger here
ElseIf lobjExample Is GetType(ULong) Then
' Solve world hunger here
ElseIf lobjExample Is GetType(UInteger) Then
' Solve world hunger here
ElseIf lobjExample Is GetType(UShort) Then
' Solve world hunger here
Else
' Cannot solve world hunger
End If
Would this be better suited as a case statement?