简体   繁体   中英

How do I differentiate between an enum's name from enum index items?

I'm having a terrible time communicating with my teammates when I talk about enums. I can never properly differentiate what part of the enum I'm talking about.

enum PowerLevel {
    Low,
    Medium,
    High
}

Low , Medium , and High are what part of the enum?

What part is PowerLevel ?

I say that "Powerlevels" is the name of the enumeration. "Low", "Medium" and "High" are the members of the enumeration. These are also sometimes called named constants or elements.

This page actually uses all three names: http://msdn.microsoft.com/en-gb/library/sbbt4032(v=vs.80).aspx

The enum is powerlevels. It has three different values/instances : low, medium and high.

Low is an instance of powerlevels and is guaranteed to be a singleton.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM