Type Conversion Functions
Earlier in the chapter, I recommended that you use Option Strict On and Option Explicit On. These settings will let the compiler help you catch errors at compile-time because they preclude a lot of implicit type conversions. You still need a good way to convert data from one type to another. To this end Visual Basic .NET includes dozens of type conversion capabilities.
Also noted throughout this chapter is the introduction of the ToString method in the Object class. Because every class and structure is an Object, every type contains a ToString conversion method. Many types also contain a method that takes a string argument and converts it to a specific type. For example, in the DateTime type, the Shared Parse method ...
Get Visual Basic® .NET Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.