Created
December 12, 2018 15:40
-
-
Save andreisfedotov/020b941ddb9412dd38d9df6861c2db21 to your computer and use it in GitHub Desktop.
This file contains 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
enum Items : byte | |
{ | |
DisabledFlag = 1 << 7; | |
One = 1; | |
Two = 2; | |
Three = 5; | |
} | |
//========= | |
[DataMember] | |
private bool IsDisabled | |
{ | |
get { return (CODE & (byte) Items.DisabledFlag) > 0; } | |
set | |
{ | |
CODE = value | |
? (byte)(CODE | (byte) Items.DisabledFlag) | |
: (byte)(CODE & (byte.MaxValue ^ (byte) Items.DisabledFlag)); | |
} | |
} | |
[DataMember] | |
private byte Code | |
{ | |
get { return (byte)(CODE & (byte.MaxValue ^ (byte) Items.DisabledFlag)); } | |
set | |
{ | |
CODE = IsDisabled | |
? (byte) (value | (byte) Items.DisabledFlag) | |
: value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment