It looks like you are right after the << operator, but this only performs a left shift; It will not rotate in LSB. To do this, you will need to make a mixture of shifts and OR. For instance:
static int RotateLeft(int value, int shift) { return (value << shift) | (value >> (32 - shift)); }
Please note that this will not work correctly if value has its upper bit set due to the expansion of the sign in the right shift. You can fix this by doing arithmetic in uint :
static int RotateLeft(int value, int shift) { unchecked { uint uvalue = (uint) value; uint uresult = (uvalue << shift) | (uvalue >> 32 - shift); return (int) uresult; } }
source share