mardi 24 février 2015

C# Enum Value's Attributes? [duplicate]


This question already has an answer here:




I have an Enum:



public enum EnumCountry
{
[Display(Name = "Canada")] CA,
[Display(Name = "US")] US
}


When I use it:



var x = EnumCountry.CA;


How do I can the "DisplayAttribute" attribute value "Canada" from the x variable?


(ASP.NET MVC)






Aucun commentaire:

Enregistrer un commentaire