-3

what is the meaning symbol ^ in c#?

like example below.

if(x ^ y)
{
    return false;
}
Milad Jafari
  • 970
  • 10
  • 15

2 Answers2

1

^ is XOR.

In this case, can be written as:

if(x != y)

which may be easier to understand (if you are unfamiliar with the XOR operator)

eye_am_groot
  • 682
  • 6
  • 19
1

^ means XOR:

x ^ y is True if only (x == true && y == false ) || (x == false && y == true).

More information

Ashkan Mobayen Khiabani
  • 33,575
  • 33
  • 102
  • 171