The only thing that astonishes me more about how much I’ve learned over my life, is how much I’ve forgotten. Until last year this list included bitmasks and bitwise operations. (Fleming’s right hand and left hand rules are still on the list!)
Only when faced with a particular problem did my I remind myself that “bitwise and bitmasks are my friend!”. At the time, I became frustrated with .NET, I knew what I wanted to do and even with the aid of Google it didn’t feel right. It felt clumsy and unsatisfying.
12 months plus later, I finally came across the FlagsAttribute class. I don’t even recall how I came across it, at the time I knew I had to commit it to memory and on further investigation I think it is awesome. So, in the spirit of good will to all men (well anyone who deals with .NET), I’d recommend having a look at the MSDN code sample and this article from dotnet slackers about it. Sure, it’s a bit old school, but bitwise is your friend!