117

I saw a loop which I've never seen before:

for (int i = 0; i < (1 << list.Count); i++)

I can't understand what (1 << list.Count) means, maybe someone could explain me this?

Zaheer Ahmed
  • 27,470
  • 11
  • 72
  • 109
user2412672
  • 1,431
  • 3
  • 19
  • 33
  • 5
    Yes. Definitely a duplicate. Also something that probably should've been googled first. Also, I can't believe the number of comments that call using shift operators "unreadable." Maybe if you had 10 of them on the same line or something, but a shift operator is a very, very basic operator and "< – reirab Jan 29 '14 at 22:51

0 Answers0