Is using reflection a design smell?
.net, c#, reflection
Solution
Examples:
- Dynamic loading of types via configuration
- Using "convention" style registration (register components with your container that implement an interface or have a certain naming convention)
- Checking for/using custom attributes/type metadata
Reflection is a tool, like "throw". should you use throw everywhere? No! So is it a code smell to use throw?
Problem
I see a lot of C#, .net questions solved here using reflection. To me, a lot of them look like bending the rules at the cost of good design (OOP). Many of the solutions look unmaintenable and "scripty". Is using reflection a good practice in general? Are there things that can only be solved by reflection? edit: Please give examples where reflection is the only good solution.