LANGUAGE

Bitwise complement ~

Inverts every bit of the promoted integral operand. Use AND with a complemented mask to clear selected bits.

Formal Syntax & Structure

csharp syntaxcsharp
~mask

Working Example

Example Snippetcsharp
int flags = 7 & ~2; // 5
C# & .NET Reference