usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespace_10.运算符之移位运算符{classProgram{staticvoidMain(string[]args){//移位运算符//>>右移运算符把操作数的补码形式向右移动N位。//<<左移运算符把操作数的补码形式向左移动N位。sbytea=65,b=-17;//65原码01000001反码01000001补码01000001//65>>3补码00001000反码00001000原码00001000=>8Console.WriteLine("{0}>>3={1}",a,a>>3);//65<<5补码00100000反码00100000原码00100000=>32Console.WriteLine("{0}<<5={1}",a,a<<5);//-17原码10010001反码11101110补码11101111//-17>>3补码11111101反码10000010原码10000011=>-3Console.WriteLine("{0}>>3={1}",b,b>>3);//-17<<5补码11100000反码10011111原码10100000=>-32Console.WriteLine("{0}<<5={1}",b,(sbyte)(b<<5));//负数进行右移时,左边空出来的位填空1。//其他进行移位时,空出来的位填空0。//按位移位赋值运算符/***<variable>>>=<value>等价于<variable>=<variable>>><value>*<variable><<=<value>等价于<variable>=<variable><<<value>*/Console.ReadKey();}}}