Question

I've been writing some code comments, and I've been trying to refer to the index integer of a enum type, but I'm not sure what it's called. I'm tempted to call it the identifier, however there is likely a word that already exists.

It's hopefully easier to see what I mean with a example.

    enum Weekday
    {
        Monday,
        Tuesday,
        Wednesday,
        Thursday,
        Friday
    }

    /// <summary>
    /// A test method
    /// </summary>
    /// <param name="weekdayId">The ... for the enum weekday</param>
    void test(int weekdayId)
    {

    }

I'm leaning towards identifier, as that seems to fit with my comment, but I just wanted to check first that there wasn't a word already. If not I think it should be called the gloopdedoop.

Was it helpful?

Solution

C# enums are a set of named [integral numeric] constants.

Each constant in the enum has a numeric value. So the word you are looking for, for the "the index integer of a enum", is just "value".

OTHER TIPS

You're just talking about the integral value here. I'd avoid using the word "index" as it doesn't necessarily follow that it will be an index in the way you describe. You can set any values for enumerations - they don't have to start at zero or one or even be consecutive.

I'd also strongly avoid referring them as numerics as that has a very specific meaning in programming - those being the super set of all integer AND floating point types. Best to avoid the confusion.

But generally speaking, I've heard programmers refer to the enum value as simply "the value" or "underlying value". It is taken as understood (by seasoned programmers) that it is an integer.

Licensed under: CC-BY-SA with attribution
scroll top