It’s of type FontStyle
i.e. Enums are first class types.
public enum FontStyle
{
Regular = 0;
Bold =1;
Italic = 2
}
// No need to cast it
FontStyle fontstyle = FontStyle.Bold;
Edit: Perhaps you have code like this:
if(1 == 1)
FontStyle fontstyle = FontStyle.Bold;
for your error (Embedded statement cannot be a declaration or labeled statement) surround your code in a block statement e.g.
if(1 == 1)
{
FontStyle fontstyle = FontStyle.Bold;
}
0
solved How to assign enum to variable