+ 1

How do these operators work? (C#)

How do these operators work? (C#) 1. >> 2. << 3. ^= 4. |= I can no idea how are they working. ------------------------------------------------------------ What is output of the following code? int x = 4; x>>=10; Console.Write(x + "/"); x=4; x<<=5; Console.Write(x + "/"); x=4; x^=3; Console.Write(x + "/"); x=4; x|=2; Console.Write(x);

12th Dec 2017, 2:00 PM
Amadeus
Amadeus - avatar
1 Answer
+ 8
Those are logical and bitwise with assignment operators. You may study more about it @ https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/index#assignment-and-lambda-operators Hopefully it helps! 😉
12th Dec 2017, 3:30 PM
Zephyr Koo
Zephyr Koo - avatar