开发者

Defining C# enums with descriptions

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜