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

Binary ^ operators are predefined for the integral types and bool. For integral types, ^ computes the bitwise exclusive-OR of its operands. For bool operands, ^ computes the logical exclusive-or of its operands; that is, the result is true if and only if exactly one of its operands is true.

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

Example

using System;
class Test {
   public static void Main() {
      Console.WriteLine(true ^ false);  // logical exclusive-or
      Console.WriteLine(false ^ false); // logical exclusive-or
      Console.WriteLine("0x{0:x}", 0xf8 ^ 0x3f);   // bitwise exclusive-or
   }
}

Output

True
False
0xc7

See Also

C# Operators | CLR 7.10.1 Integer logical operators