Export (0) Print
Expand All

6.1.2 Implicit numeric conversions

Visual Studio .NET 2003

The implicit numeric conversions are:

  • From sbyte to short, int, long, float, double, or decimal.
  • From byte to short, ushort, int, uint, long, ulong, float, double, or decimal.
  • From short to int, long, float, double, or decimal.
  • From ushort to int, uint, long, ulong, float, double, or decimal.
  • From int to long, float, double, or decimal.
  • From uint to long, ulong, float, double, or decimal.
  • From long to float, double, or decimal.
  • From ulong to float, double, or decimal.
  • From char to ushort, int, uint, long, ulong, float, double, or decimal.
  • From float to double.

Conversions from int, uint, long, or ulong to float and from long or ulong to double may cause a loss of precision, but will never cause a loss of magnitude. The other implicit numeric conversions never lose any information.

There are no implicit conversions to the char type, so values of the other integral types do not automatically convert to the char type.

Show:
© 2014 Microsoft