C#C
C#3y ago
15 replies
SWEETPONY

❔ ✅ How to get attributes values?

I have following property with custom attribute [CatalogComponent]:
[CatalogComponent]                                              
[JsonProperty( PropertyName = "event_categories" )]             
public HashSet<EventCategoryType>? EventCategories { get; set; }


EventCategoryType is enum:
public enum EventCategoryType
{
[EnumMember( Value = "undefined" )]
Undefined,

[EnumMember( Value = "diagnostics" )]
[TitleLocalized( typeof( Resources.EventCategoryTypeTitle ) )]
[DescriptionLocalized( typeof( Resources.EventCategoryTypeDescription ) )]
Diagnostics,

[EnumMember( Value = "warning" )]
[TitleLocalized( typeof( Resources.EventCategoryTypeTitle ) )]
[DescriptionLocalized( typeof( Resources.EventCategoryTypeDescription ) )]
Warning
}


So my question is it possible to get EnumMember value and TitleLocalized value from EventCategoryType in custom attribute?
Was this page helpful?