Tangible Software Solutions

The Most Trusted Name in Source Code Conversion

  • Trusted for over 12 Years
  • Saves Valuable Time
  • Accurate and Reliable
  • Responsive Support

C# Equivalent to VB Select

For simple cases, VB's Select construct can be converted to the C# switch construct.  However, if any of the Case statements include range or non-constant expressions, then the equivalent is an if/else block.

For example, the following VB code:
Select Case x
Case 1 To 3
    ...
Case Is < 10, Is > 20, Is = 15
    ...
End Select

Has the following C# equivalent:
if (x >= 1 && x <= 3)
    ...
else if ((x < 10) || (x > 20) || (x == 15))
    ...

If you need to convert between VB and C# and you are depending on the results being reliable and accurate, then you will want to have Instant C#, the best VB to C# converter, or Instant VB, the best C# to VB converter, at your fingertips.

Copyright © 1997 - 2017 Tangible Software Solutions Inc.