This documentation is archived and is not being maintained.
8.8 Widening Conversions
Visual Studio .NET 2003
Widening conversions never overflow but may entail a loss of precision. The following conversions are widening conversions:
- Conversions from any derived type to one of its base types.
- Numeric type conversions in the following direction: Byte, Short, Integer, Long, Decimal, Single, Double. Conversions from Integer to Single, Long to Single or Double, or Decimal to Single or Double may cause a loss of precision, but will never cause a loss of magnitude. The other widening numeric conversions never lose any information.
- Conversions from the literal Nothing to any type.
- Conversions from the literal
0to any enumerated type.
- Conversions from any enumerated type to its underlying type, or to any type that its underlying type has a widening conversion to.
- Conversions from any reference or value type to an interface type that the value or reference type implements.
- Conversions from an array type
Swith an element type
SEto a covariant-array type
Twith an element type
TE, provided all of the following are true:
Tdiffer only in element type.
TEare reference types.
- A widening reference conversion exists from
- Conversions from Char to String.
- Conversions from Char() to String.
- Conversions from a constant expression of type Long, Integer, Short, or Byte to a narrower type, provided the value of the constant expression is within the range of the destination type.