O'Reilly logo

Visual Basic 2010 Unleashed by Alessandro Del Sole

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Widening and Narrowing Conversions

With the exception of boxing and unboxing, basically conversions are of two kinds: widening conversions and narrowing conversions depending if the conversion is explicit or implicit. This is explained next.

Widening Conversions

Widening conversions occur when you try to convert a type into another one that can include all values of the original type. A typical example of a widening conversion is converting from an Integer into a Double, as in the following lines of code:

'Widening conversion Dim i As Integer = 1 Dim d As Double = i

As you might remember from Table 4.2, Integer represents a numeric value whereas Double represents a large floating number. Therefore, Double is greater than Integer and therefore ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required