I'm working with some old code, trying to improve it, and I came across the following, which I am having trouble understanding:
controlToUpdate.Font =
new System.Drawing.Font(someFont,
someFontSize,
controlToUpdate.Font.Style ^
(controlToUpdate.Font.Style & FontStyle.Bold));
Specifically, I am confused as to what the last parameter does. As I understand it, the following should do a bitwise comparison, and return the result:
controlToUpdate.Font.Style ^ (controlToUpdate.Font.Style & FontStyle.Bold)
..but what does that mean in this situation? What are the possible results, that may be passed as the third parameter to new Font(...), and how can I rewrite this more clearly, while keeping with the intent of the original programmer?
Sidenote: Is this a normal way to do things when working with Windows Forms? I'm a little new in that area - is the intent here obvious to coders more experienced in this field?