简体   繁体   English

如何区分枚举索引项的枚举名称?

[英]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? LowMediumHigh是枚举的一部分?

What part is PowerLevel ? PowerLevel是什么部分?

I say that "Powerlevels" is the name of the enumeration. 我说“Powerlevels”是枚举的名称。 "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 这个页面实际上使用了所有三个名称: 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. Low是powerlevels的一个实例,保证是一个单例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从“名称”的字符串表示中选择枚举值? - How do I select an enum value from the string representation of the 'name'? 如何从整数实例化枚举? - how do I instantiate an enum from an integer? 如何在SQL中将特定索引值添加到枚举,例如enum('a'= 5,'b',c'= 20)。 有什么可以做的吗 - How to add specific index values to enum's like enum('a'=5,'b',c'=20) in SQL. Is there any to do this 如何配置 Serde 以使用枚举变体的判别式而不是名称? - How do I configure Serde to use an enum variant's discriminant rather than name? 我可以在运行时在 Swift 中从枚举名称和值的 rawValue 实例化或生成枚举值吗? - Can I instantiate or produce an enum value from the enum name and the value's rawValue at runtime in Swift? 如何在特定索引处返回枚举的字符串? - How do I return the string of an enum at a specific index? 从Enum名称的字符串文字返回Enum值列表 - Return List of Enum values from string literal of Enum's name 如何从 TypeScript 中的合并枚举中排除某些项目? - How can I exclude some items from a merged enum in TypeScript? 从 object 获取枚举索引? (爪哇) - Getting an enum's index from an object? (Java) 如何在(字符串,标志列表,带标志的枚举)之间转换枚举? - How do I convert an enum between (string, list of flags, enum with flags)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM