❔ ✅ How to get attributes values?
I have following property with custom attribute
[CatalogComponent]
:
EventCategoryType
is enum:
So my question is it possible to get EnumMember value and TitleLocalized value from EventCategoryType in custom attribute?11 Replies
using reflection, sure
okay, let's see
we have this property:
how can I get T in CatalogComponent?
wait is it generic or is it EventCategoryTypes
different types but A, B, C will have EnumMember and TitleLocalized
anyway to get T you look into GetType()
probably it would be GenericTypeArgument
I can do this..
for the attributes, you have to search into Field for GetCustomAttribute
hm I will try
smth like that..?
is it good solution?
this is, generically, the part that would check the attribute of an enum
one way to do it
so there's a step in between, GetField
sadly it's not the easiest thing to do
anyway you can inspect GetType() and look around for what you need
okay, I see
I did this and it works well:
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.