<分区>
嗨
我有以下枚举
public enum Priority : byte
{
A=1,
B+ = 2,
B=4,
C=8,
D=16,
E=32
}
我想在枚举中添加 B+
但它给我错误
<分区>
嗨
我有以下枚举
public enum Priority : byte
{
A=1,
B+ = 2,
B=4,
C=8,
D=16,
E=32
}
我想在枚举中添加 B+
但它给我错误
最佳答案
您可以为枚举添加用户友好的描述,如下所示:
enum MyEnum
{
[Description("This is black")]
Black,
[Description("This is white")]
White
}
关于c# - 枚举的显示文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8697890/
相关文章:
.net - XSD 第一个合约 - WCF Soap Web 服务
.net - Silverlight 4.0 和 WCF 客户端代理 - 如何创建和关闭实例
c# - 在 View 模型中过滤数据后,它不显示/刷新 View
c# - Entity Framework : Serialize/Deserialize JSON column behind the scene
asp.net-mvc-3 - 如何读取 ASP.Net MVC 3 Web API 2.1 Controller 中的 POST 数据?
c# - 开发 express MVVM : Injected ViewModel is also created by XAML.