C# Select Case = Switch
If like me you have converted from VB.Net to C# then this is a handy bit of code:
VB Version:
Dim iSwitch as Integer = 1
Dim iOut as Integer
Select Case iSwitch
Case 1
iOut = 1
Case 2
iOut = 2
Case Else
iOut = 3
End Select
''iOut = 1
C# Conversion
int iSwitch = 1;
int iOut = 0;
switch (iSwitch )
{
case 1:
iOut = 1;
break;
case 2:
iOut = 2;
break;
default:
iOut = 3;
break;
}
//iOut is = 1;
Thanks,
Adrian