Type Conversion — Visual Basic .NET

CType works generally.

DirectCast is preferred, but only works between types where one inherits the other.

TryCast is the same as DirectCast, but returns Nothing on failure rather than an exception.