Created
April 12, 2014 07:16
-
-
Save dchw/10522737 to your computer and use it in GitHub Desktop.
Using left shit to achieve a continuous range of values, while still using bit fields appropriately.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Flags] | |
public enum Powers : byte | |
{ | |
Speed = 1, | |
Looks = 1 << 1, | |
Money = 1 << 2, | |
Smart = 1 << 3, | |
None = 1 << 4 | |
} | |
public enum Superhero | |
{ | |
Superman, | |
Batman, | |
Aquaman, | |
IronMan | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment