NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

~ Operator

The ~ operator performs a bitwise complement operation on its operand. Bitwise complement operators are predefined for int, uint, long, and ulong.

User-defined types can overload the ~ operator (see operator).

Example

using System;
class Test {
   public static void Main() {
      Console.WriteLine("!0x{0:x8} = 0x{1:x8}", 8, ~8);
      Console.WriteLine("!0x{0:x8} = 0x{1:x8}", -8, ~-8);
   }
}

Output

!0x00000008 = 0xfffffff7
!0xfffffff8 = 0x00000007

See Also

C# Operators | CLR 7.6.4 Bitwise complement operator