首页 > 其他 > 详细

数值类型

时间:2015-06-10 15:34:44      阅读:220      评论:0      收藏:0      [点我收藏+]

数值后缀

  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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!