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 0 to 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 S with an element type SE to a covariant-array type T with an element type TE, provided all of the following are true:
    • S and T differ only in element type.
    • Both SE and TE are reference types.
    • A widening reference conversion exists from SE to TE.
  • 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.

See Also

8.5 Array Covariance | 8.9 Narrowing Conversions | 8. Conversions | Conversion Summary (Visual Basic Language Reference) | Widening and Narrowing Conversions (Visual Basic Language Concepts)