What does '^' do in c# (Enums)?

前端 未结 4 845
不思量自难忘°
不思量自难忘° 2021-01-12 02:40

I was reading some 3rd party code and I found this:

x.Flags = x.Flags ^ Flags.Hidden;

What does it do?

I\'ve used \'&\' and \'|

4条回答
  •  自闭症患者
    2021-01-12 03:16

    It's the exclusive OR (XOR) operator, this link has example usage

    http://weblogs.asp.net/alessandro/archive/2007/10/02/bitwise-operators-in-c-or-xor-and-amp-amp-not.aspx

提交回复
热议问题