I have some attribute that i define. I want to write some generic method that will get where this contain this attribute.
How to implement this ?
I have some attribute that i define. I want to write some generic method that will get where this contain this attribute.
How to implement this ?
If with 'attribute' you mean property: That will only work if T
is an interface or (base) class / struct. If not, it wouldn't work. You can't check for having a property or field, just if it implements or derives from.
If you don't have a shared interface or base class, your only option is to use dynamic
or reflection.
If you mean 'attribute' as in attribute: not possible.