Skip to content

Instantly share code, notes, and snippets.

@arman-hpp
Created May 21, 2020 03:15
Show Gist options
  • Save arman-hpp/ef87991f7768976b70e609b32f564d21 to your computer and use it in GitHub Desktop.
Save arman-hpp/ef87991f7768976b70e609b32f564d21 to your computer and use it in GitHub Desktop.
Tilde Enum
public enum TestEnum
{
A,
B,
C
}
var t = ~TestEnum.A; // t = ~1;
var t = ~TestEnum.B; // t = ~1;
var t = ~TestEnum.C; // t = ~1;
// ----------------------------------------------------------
public enum TestEnum
{
A,
B,
C,
All = ~0
}
var t = TestEnum.All; // t = ~1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment