开发者

Defining C# enums with descriptions

开发者 https://www.devze.com 2022-12-18 10:21 出处:网络
What would the folowing VB.NET e开发者_如何学编程num definition look like in C#? Public Enum SomeEnum As Integer

What would the folowing VB.NET e开发者_如何学编程num definition look like in C#?

Public Enum SomeEnum As Integer
    <Description("Name One")> NameOne = 1
End Enum


public enum SomeEnum : int
{
    [Description("Name One")] NameOne = 1
}


public enum SomeEnum: int
{
    [Description("Name One")]
    NameOne = 1,
}


Try the following

enum SomeEnum
{
    [Description("Name One")] NameOne = 1
}


public enum SomeEnum : int
{
[Description("Name One")]
NameOne = 1
}


public enum SomeEnum 
{
[Description("Name One")]
NameOne = 1
}


Like this:-

public enum SomeEnum
{
   [Description("Name One")]
   NameOne = 1;
}


public enum SomeEnum : int 
{ 
    [Description("Name One")] NameOne = 1 
} 
0

精彩评论

暂无评论...
验证码 换一张
取 消