Possible Duplicate:
what does |= (single pipe equal) and &=(single ampersand equal) mean in c# (csharp)
Here is the context where it is being used:
long dirtyFlag = 0x0000;
if (erd.SupervisorCompType != orgErd.SupervisorCompType) // change has been made?
{
dirtyFlag |= 0x0001;
// etc...
}
dirtyFlag |= 0x0001 is equivalent to dirtyFlag = dirtyFlag | 0x0001. The | operator is the bitwise OR operator. In your case, it sets the lowest binary bit. Some further examples:
1 | 2 = 3 (0001 | 0010 = 0011)
2 | 4 = 6 (0010 | 0100 = 0110)
5 | 1 = 5 (0101 | 0001 = 0101)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With