下表显示了预定义的隐式数值转换。隐式转换可能在多种情形下发生,包括调用方法时和在赋值语句中。
从 | 到 |
---|---|
short, int, long, float, double, ordecimal |
|
short、ushort、int、uint、long、ulong、float、double 或 decimal |
|
int、long、float、double 或 decimal |
|
int、uint、long、ulong、float、double 或 decimal |
|
long、float、double 或 decimal |
|
long、ulong、float、double 或 decimal |
|
float、double 或 decimal |
|
ushort、int、 uint、 long、ulong、 float、 double 或 decimal |
|
double |
|
float、 double 或 decimal |