Versatile software engineer with a background in .NET consulting and CMS development. Working on regaining my embedded development skills to get more involved with IoT opportunities.
In C#, I use something called the static enum pattern, which I first learned of from the linked blog. I find it gives me more control over enum values: casting is more explicit, I know the data types involved in the enum definition, and it is impossible to select an enum value outside of the legal range, which is a big problem in C#. Not sure if TS will let you arbitrarily cast any number to an enum, regardless of if an enum value has been defined for that number.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
In C#, I use something called the static enum pattern, which I first learned of from the linked blog. I find it gives me more control over enum values: casting is more explicit, I know the data types involved in the enum definition, and it is impossible to select an enum value outside of the legal range, which is a big problem in C#. Not sure if TS will let you arbitrarily cast any number to an enum, regardless of if an enum value has been defined for that number.