Information Technology Reference
In-Depth Information
Types of Conversions
There are a number of standard, predefined conversions for the numeric and reference types.
The categories are illustrated in Figure 18-7.
Beyond the standard conversions, you can also define both implicit and explicit conver-
sions for your user-defined types.
There is also a predefined type of conversion called
boxing
, which converts any value
type to either
-Type
object
-Type
System.ValueType
Unboxing converts a boxed value back to its original type.
Figure 18-7.
Types of conversions
Numeric Conversions
Any numeric type can be converted into any other numeric type, as illustrated in Figure 18-8.
Some of the conversions are implicit conversions, and others are explicit.
Figure 18-8.
Numeric conversions