The signature of the acceptance method is as follows:
public Font(Font prototype, FontStyle newStyle)
{
...
}
| ( ) , , . , FontStyle - enum, FlagsAttribute. FontStyle:
[Flags]
public enum FontStyle
{
Bold = 1,
Italic = 2,
Regular = 0,
Strikeout = 8,
Underline = 4
}
, FontStyle.Bold | FontStyle.Italic, :
FontStyle.Bold = 1 = 00000001
FontStyle.Italic = 2 = 00000010
FontStyle.Bold | FontStyle.Italic = 3 = 00000011
style, , , (&). , , , :
FontStyle myStyle = FontStyle.Bold | FontStyle.Italic;
bool isBold = (myStyle & FontStyle.Bold) == FontStyle.Bold;
, Bold Font , FontStyle.Bold , , , :
public bool Bold
{
get
{
return ((this.Style & FontStyle.Bold) != FontStyle.Regular);
}
}
, .NET Framework 4, Enum.HasFlag() . , ( # 6):
public bool Bold => this.Style.HasFlag(FontStyle.Bold);