Singular or plural for enumerations?

后端 未结 7 1672
长发绾君心
长发绾君心 2021-01-31 12:56

Do you use singular or plural for enumerations? I think it makes best sense with plural in the declaration

enum Weekdays
{
    Monday,
    Tuesday,
    Wednesday         


        
相关标签:
7条回答
  • 2021-01-31 13:51

    In general, I consider an enum definition to be a type definition, with the values of the enum being the different values the type can have; therefore it gets a singular name:

    enum Weekday { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY };
    
    enum CoffeeSize { SMALL, MEDIUM, LARGE };
    
    0 讨论(0)
提交回复
热议问题