XOR operation for two boolean field

Solution 1:

bool xorValue = bool1 ^ bool2;

Solution 2:

Ok to add some context: You can look here Tables

There you can see that "exclusive or" is basically the same as "not equal". So you could just use this (with boolean):

if (X != Y)...

But if you want to directly show people you mean "XOR" just use the other answers here.

Solution 3:

C# has logical XOR operator ^. Here's how you do it.

bool result = x ^ y // x XOR y