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,
Put = 1 << 2,
Delete = 1 << 3,
Head = 1 << 4
}
and I'm just curious as to what the double left angle brackers <<
does.
That would be the bitwise left shift operator.
For each shift left, the value is effectively multiplied by 2. So, for example, writing value << 3
will multiply the value by 8.
What it really does internally is move all of the actual bits of the value left one place. So if you have the value 12 (decimal), in binary that is 00001100
; shifting it left one place will turn that into 00011000
, or 24.