What do two left-angle brackets “<<” mean in C#?

前端 未结 15 2032
长情又很酷
长情又很酷 2020-12-12 13:55

Basically the questions in the title. I\'m looking at the MVC 2 source code:

[Flags]
public enum HttpVerbs {
    Get = 1 << 0,
    Post = 1 << 1,         


        
15条回答
  •  半阙折子戏
    2020-12-12 14:01

    << is the left bit shift operator. If you have the number 3, which is 00000011 in binary, you can write 3 << 2, which is 00001100, or 12 in decimal.

提交回复
热议问题