What does the “>>” operator in C# do?

前端 未结 5 442
借酒劲吻你
借酒劲吻你 2020-12-11 17:10

I ran into this statement in a piece of code:

Int32 medianIndex = colorList.Count >> 1;

colorList is a list of class

5条回答
  •  醉酒成梦
    2020-12-11 17:44

    It's not very readable code, basically it just divides the number by 2.

    >> is the shift-right operator, shifting all bits one position to the right.

    0110 (6) becomes 0011 (3)

提交回复
热议问题