I’ve just started working in C#, and I would like to define a new type (
Priority) as an integer, going from 1 to 9. In top of this, I would like to create three new constants:
pri_Low, which has value 1 pri_Default, which has value 5 pri_High, which has value 9
I though of doing something like this: (C-style)
typedef TPriority = 1..9; Const TPriority pri_Low 1; Const TPriority pri_Default 5; Const TPriority pri_High 9;
But when I look for this on the internet, I get answers like “You need to create a class, and you need to declare it
static, and …”.
My first reaction is “Hold your horses. I just want to create a simple range of numbers and give a meaning to three of them. No classes, no constructors, no
friend or whatever fancy things, just simple basics.”, is this even possible or is C# that into “Everything is a class” that such simple things are not even allowed?