.NET: What attribute would you use to describe an Enum value? -


lets have enum:

public enum applicationstatus     <foo("active")> active = 1     <foo("inactive")> inactive = 2     <foo("retired")> retired = 3     <foo("in development")> indevelopment = 4 end enum 

what attribute should use in place of foo plain-text descriptions of enum?

i've used description mine, in cases when enumeration needs display differently, otherwise displays string of enum value.

i've use method checks case of each character in enum item , if it's uppercase character after 1st, adds space before character.

public enum applicationstatus     active = 1     inactive = 2     retired = 3     indevelopment = 4     <description("radical display name")> radical = 5  end enum 

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -