Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using static within an enum

Is it possible to use 'static' within an enum as such:

private enum pdfMode
{
   generate,
   static
}

Obviously 'static' is a key word.

It would be nice as I have a pdfMode which is indeed referred to within the app as 'static'.

like image 938
m.edmondson Avatar asked Nov 27 '22 15:11

m.edmondson


2 Answers

To use a keyword as an identifier use the @ symbol:

@static

But using Pascal case is advisable here.

private enum PdfMode
{
   Generate,
   Static
}

See the Enumeration Type Naming Guidelines:

Use Pascal case for Enum types and value names.

like image 56
Mark Byers Avatar answered Dec 05 '22 04:12

Mark Byers


One possibility is to use Generate and Static inside the enum. IMO uppercase looks best there anyway.

like image 44
Øyvind Bråthen Avatar answered Dec 05 '22 06:12

Øyvind Bråthen