Implicit numeric conversions
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. Implicit enumeration conversions An implicit enumeration conversion permits the decimal-integer-literal 0 to be converted to any enum-type and to any nullable-type whose underlying type is an enum-type. In the latter case the conversion is evaluated by converting to the underlying enum-type and wrapping the result (§4.1.10).
|