标签:
数值后缀
float f = 1.0f;
double d = 1D;
decimal d = 1.1m;
数值类型转换
int x =1234;
long y = x;
short z = (short)x;
int i=1;
float f = i;
int d = (int)f;
整形运算溢出检查运算符checked
int a = int.MaxValue;
checked{
a++; //抛出异常
}
unchecked 取消溢出检查
位运算符
~
&
|
^
<<
>>
short 没有自己的运算符 x y 会转换成 int运算 结果也是 int
short x = 1, y = 1;
short z = (short)(x + y);
标签:
原文地址:http://www.cnblogs.com/hlhxd/p/4566046.html