If you capitalize public
to Public
it won't be recognized as a keyword. Keywords are case sensitive.
As a general practice, however, it's a bad idea to use names that are keywords (even when they differ by case) as it can cause confusions, or even subtle defects if the keyword is accidentally used in place of the identifier.
It's also possible to use the @
in certain contexts (like variable or member declarations) to use reserved words as non-keywords. However, it's not a common practice and should only be a means of last resort, when you can't use a different name.
So in your case you could also use @public
to use the reserved word as an enum identifier.
If you chose to use @
, be aware that the symbol is only used in your source code to differentiate the identifier from the reserved word. To the outside world (and in methods like Enum.Parse()
), the name of the enum value is simply public
.