Is public const bad? #12
Replies: 1 comment 1 reply
-
|
In my opinion, one of the best usage of constants is to use them as enum in models. Example: We have a class called Post and it has a property called PostType. The PostType holds a few values such as News, Article, PremiumPost and etc. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is public const bad?
Is declaring a number or string as public const considered bad practice? Let's have a look what a const variable means in the first place.
Let's find out and also check what are the alternatives.
https://steven-giesel.com/blogPost/bfb3e48e-c18b-40f1-97f8-b4c8d97a0f95
Beta Was this translation helpful? Give feedback.
All reactions