+ 2

# What does it means int x<< 2 in C#

x is a Integer values, I don't understand '<<' that kind of operator in C#

4 Answers

+ 3

It's the bit shift operator. What this is doing is shifting x two bits to the left.
Consider the binary representation of two: 0010. If we shift it two bits to the left (2 << 2), we wind up with 1000 (zeroes are added to the end). Convert that back into decimal, and you have 8.

+ 2

I agree with you. '<<' is left binary shift operator. and after left shifting 2-time but what is the value of 'x' before left shift. and also 'int' is on the expression

0

fg

0

what is the value of x?