Like others, they are bitwise operators. FontStyleis a bit field (a set of flags).
oldf.Style & ~FontStyle.Bold
It means βremove the boldβ, but looking at the basic math, you get something like this.
(a) FontStyle.Bold = 0b00000010;
(b) oldf.Style = 0b11100111;
(c) ~FontStyle.Bold = 0b11111101;
=> (b) & (c) = 0b11100101;
new Font(oldf, oldf.Style | FontStyle.Bold)
This means that we want to highlight the Bold font. By OR'ing with the existing value (this also means that what is already in bold will remain in bold).
(a) FontStyle.Bold = 0b00000010;
(b) oldf.Style = 0b11100000;
=> (b) | (c) = 0b11100010;
source
share