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.
Definition. The left-shift operator (<<) shifts its first operand left by the number of bits specified by its second operand. The type of the second operand must be an int. <<
angular brackets are used for global use of the header files which are predefined and we include in our program. if we use user defined header file we need put " " instead of < >
Angle brackets in programming languages In C++ chevrons (actually less-than and greater-than) are used to surround arguments to templates. In the Z formal specification language chevrons define a sequence.
61. >> can be used to pipe output into a text file and will append to any existing text in that file. 'any command' >> textfile.txt. appends the output of 'any command' to the text file.
When you write
1 << n
You shift the bit combination 000000001
for n
times left and thus put n
into the exponent of 2:
2^n
So
1 << 10
Really is
1024
For a list of say 5 items your for
will cycle 32 times.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With