The << operator cannot be applied to operands of type long and long

I am trying to use the << operator on long , for example:

 ((long) num3) << ( 2 + (long) num4))) 

This gives me the following error:

The <operator cannot be applied to operands of type long and long.

If I don't throw num4 on long , there is no error. However, I cannot save it as an int . Is there any other way around this?

+6
source share
1 answer

The correct operand must be int , not long . It would be impractical to use long as the number of bits for the offset, since integral types in C # never have more than 64 bits.

+13
source

Source: https://habr.com/ru/post/977895/


All Articles