0

I'm trying to understand the bitwise operators related to a piece of code I found. So far I failed to understand the shifting part. Could someone explain to me related to below sample code?

The example list:

var list = new List<int>();

int[] input = { 0, 2, 15, 19, 31, 32};

list.AddRange(input);

Then part of a code:

foreach (var i in list)
{

    var pos = i >> 3;
}

What does the i >> 3 relate to? To the list position or the input value position?

  • Why don't you run the code in debug and see what happens? or just add prints? – Guy Mar 11 '18 at 08:25
  • I see what happens and the binaries coming up, I don't understand how they relate to eachother. But digging through https://www.tutorialspoint.com/csharp/csharp_operators.htm now –  Mar 11 '18 at 08:29

0 Answers0