I have an enumeration in F #:
type Gender = Undisclosed = 0 | Male = 1 | Female = 2
Equivalent C # code would be
public enum Gender { Undisclosed, Male, Female }
In fact, in C #, I can go one step better. To use the gender in the drop-down list on the cshtml page, I can do this:
public enum Gender { [Display(ResourceType = typeof(LocalisedStrings), Name = "GenderUndisclosed")] Undisclosed, [Display(ResourceType = typeof(LocalisedStrings), Name = "GenderMale")] Male, [Display(ResourceType = typeof(LocalisedStrings), Name = "GenderFemale")] Female }
Unfortunately, the F # compiler says that โattributes are not allowed hereโ if I try to add similar annotations to the members of the F # enumeration. Is there any way around this? I would like to avoid duplicating the class and running Automapper voodoo if possible.
source share