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 Casts

The closest equivalent to the standard VB casting macros (CType and the corresponding CInt, CStr, etc.) are calls to the System.Convert methods if the appropriate method exists, otherwise they are converted to the standard C# casting operator. 

The behavior of both the System.Convert methods and the standard C# casting operator are subtly different from the VB casting macros though, so you should always test the behavior of your converted C# code.

The C# equivalent to VB's DirectCast is the standard C# casting operator.

The VB TryCast operator always converts to the C# as operator.

If you need to convert from VB to 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, at your fingertips.

Copyright © 1997 - 2017 Tangible Software Solutions Inc.