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

    /// <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.


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".

| improve this answer | |
  • 5
    Something like "The value of the enum". That's it. The name of the enum is the "named constant" (Friday) the value of the enum Fridays is 5 (or whatever). – Laiv Nov 20 '19 at 11:47
  • 2
    @robbie-dee, please don't change "numeric" to "integer". C# enum values can be any of the integral numeric types, not just integer. – David Arno Nov 20 '19 at 13:19
  • 2
    @DavidArno Numeric could be taken to mean floating point types - hence my change, but feel free to be wrong (again) :) – Robbie Dee Nov 20 '19 at 13:21
  • 3
    @DubDub: Arguably, you can call Weekday.Friday a value just as much as 5 (its integer counterpart) is a value. But since these are completely interchangeable from a C# perspective, it often doesn't particularly matter to distinguish between them. When it does, using "integer value" to distinguish seems more than adequate. – Flater Nov 20 '19 at 13:56
  • 1
    This is incorrect for the reason I've described. It must be an integral type. Simply calling it numeric is wrong. – Belgian Dog Nov 20 '19 at 21:30

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.

| improve this answer | |
  • FWIW, in Java it is officially called the ordinal. (But Java enums are entirely different from C# enums!) – user253751 Nov 20 '19 at 22:53
  • "It is taken as understood (by seasoned programmers) that it is an integer." And integer has a specific meaning too. But really experienced programmers understand that by "integer" you mean "any value within the numeric range supported by the chosen underlining type of the enum". Of course inexperienced programmers might assume only integers are allowed. So by being incorrectly pedantic, you've sown more confusion. Which is why it's better to just use the general term "numeric" and guide the user to a precise description of supported numeric types and values. Just as I did. – David Arno Nov 21 '19 at 8:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.