-3

Just walked through referencesource.microsoft.com (line 217)

and discovered "|=" operator. What does it means? I assume it some sort of Boolean operation- but can't get what exactly it means. Does it mean "or equal", short form like "a= a|b" ?

Max Iakovliev
  • 173
  • 1
  • 2
  • 7

3 Answers3

4

|= is to = what += is to =. Just a shortcut to avoid the writing of a = a | b

Thomas Ayoub
  • 29,063
  • 15
  • 95
  • 142
2

its a bitwise inclusive OR and assignment operator.

For details refer https://msdn.microsoft.com/en-us/library/ms173224.aspx

Partha Bisoi
  • 173
  • 2
  • 15
1

You are correct. This operator is known as the "OR assignment" operator and a |= b is equivalent to a = a | b. Here is the documentation.

Alfred Rossi
  • 1,942
  • 15
  • 19