mardi 29 août 2017

c# How to get enum from custom attribute?

This is MyEnum

public class CountryCodeAttr : EnumAttr
{
    public string Code { get; set; }
    public string Description { get; set; }
}

public enum CountryCode
{
    [CountryCodeAttr(Code = "Unknown", Description = "Unknown")]
    Unknown,
    [CountryCodeAttr(Code = "CH", Description = "Swiss", Currency="CHF")]
    CH
....

}

How can I, get the enum with a specific CountryCodeAttr? for example from attribute Currency?





Aucun commentaire:

Enregistrer un commentaire