Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Defining C# enums with descriptions

Tags:

c#

enums

vb.net

What would the folowing VB.NET enum definition look like in C#?

Public Enum SomeEnum As Integer
    <Description("Name One")> NameOne = 1
End Enum
like image 912
Kevin Avatar asked Jan 27 '10 15:01

Kevin


2 Answers

public enum SomeEnum : int
{
    [Description("Name One")] NameOne = 1
}
like image 195
dtb Avatar answered Sep 28 '22 13:09

dtb


public enum SomeEnum: int
{
    [Description("Name One")]
    NameOne = 1,
}
like image 43
Ozgur Ozcitak Avatar answered Sep 28 '22 13:09

Ozgur Ozcitak