XOR in C#

Random factoid:

Use  ^  for bitwise XOR in C#, for example:

  a = a ^ c;   (or simply:   a ^= c;)


Comments (4)
  1. C.K. "B.C." says:

    Thank you!!

    I needed to code a method that used xor in C# and I didn’t know how, I didn’t have any resource besides google that could tell me, and when I googled, I did not have any luck, for maby ten minutes of searching >:( but then I found this. probelm solved. Thanks!!

    solution completed, an exerpt of my code:

    static bool toggle(bool input)


    return input ^ true;


Comments are closed.

Skip to main content