Judging by your comment that you donβt understand what Xor is doing here, I think the explanation will help you more than the artificial alternative construction. If you want to understand how this works, you first need to know about bitwise operations. Once you know this, imagine that for a font, font styles are saved as 0s and 1s. For simplicity, suppose there are 3 bits, the first for bold, the second for italics, and the third for underscores. (So ββ101 is in bold, 011 is in italics, etc. In addition, FontStyle.Bold is 100, etc.).
Then, by analogy with bitwise operations:
oldstyle Or FontStyle.Bold creates a new style that is bold, regardless of whether the old style was. (If oldstyle was FontStyle.Italic = 010 , then 010 Or 100 = 110 , so the new style is highlighted in bold italics.)
oldstyle Xor FontStyle.Bold creates a new style that is shown in bold if the old style was not, and not bold if the old style is in bold. (Say the oldstyle was bold and italic, so 110 , then 110 Xor 100 is 010 , so italics. If, however, the old style was normal 000 , then 000 Xor 100 is 100 so it's just bold.)
source share