I have defined a custom attribute and added it to a few classes. Know I'm using reflection to capture all types in the assembly. I want to filter out only the type that have this attribute defined.
I've seen the Attributes
property for a Type object, but it returns only the values contained in a specific enum.
How can I retrieve types having a custom attribute defined?
You can do that:
But I prefer to use custom extension methods:
(they work also for assemblies, methods, properties, etc, not just for types)