The FontStyle Enumeration and Bitwise Operations
The FontStyle enumeration has a Flags attributes that allows bitwise operations on FontStyle values. For example, look at the following statement:
lblSampleText.Font.Style | FontStyle.Underline
Here the | operator will turn on all the bits representing the Underline style, returning a FontStyle value that adds Underline to the existing font Style of lblSampleText.
The following expression involves a bitwise exclusive OR (XOR) operation:
lblSampleText.Font.Style ^ FontStyle.Underline
This expression returns a FontStyle value that toggles the Underline font style of the label. If the label was already underlined, the new value has the underline removed; if the label was not underlined already, the Underline bits are set in the new value.
The following expression involving a bitwise AND does not have any effect because using AND with 1 always returns the original value:
lblSampleText.Font.Style & FontStyle.Underline
PS : Leave your feedbacks/comments here