c# - What is the best way to attach a label to an enum value -
lets have enum definition so:
public enum ecommenttype { normalcomment = 0, openningcomment = 1, startprogresscommetn = 2, clousercomment = 3, reopennigncomment = 4 } now want present enum option on web page. use switch statement when add new value have update switch statement. best way append label each value or event better resource id support multilingual interface?
p.s use mvc current project appreciate general answer used across many technologies i.e. design pattern.
event better resource id support multilingual interface?
you can get text resources
var text = normalcomment.getname(); public static class enumextension { public static string getname(this ecommenttype type) { return strings.resourcemanager.getstring(type.tostring()); } }
Comments
Post a Comment