7


3

説明付きのC#列挙型の定義

C#では、次のVB.NET列挙型定義はどのようになりますか?

Public Enum SomeEnum As Integer
     NameOne = 1
End Enum

7 Answer


8


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


4


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


3


以下を試してください

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


2


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


0


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


0


このような:-

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


0


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