Value Changes During Conversions
A conversion from a value type stores a copy of the source value in the destination of the conversion. However, this copy is not an exact image of the source value. The destination data type stores values differently, and even the value being represented might change, depending on the kind of conversion being performed.
Changes During Widening and Narrowing Conversions
Narrowing conversions change the destination copy of the source value with potential information loss. For example, a fractional value is rounded when converted to an integral type, and a numeric type being converted to Boolean is reduced to either True or False.
Widening conversions preserve the value but can change its representation. This happens if you convert from an integral type to Decimal, or from Char to String.
The original source value is not changed as a result of a conversion.
Changes During Reference Type Conversions
A conversion from a reference type copies only the pointer to the value. The value itself is neither copied nor changed in any way. The only thing that changes is the data type of the variable holding the pointer. In the following example, the data type is converted from the derived class to its base class, but the object now pointed to by both variables is unchanged:
' Assume class CSquare inherits from class CShape. Dim Shape As CShape Dim Square As CSquare = New CSquare ' ... Shape = Square ' Widening conversion from derived class to base class.