I understand the reflection API (in c#) but I am not sure in what situation would I use it. What are some patterns - anti-patterns for using reflection?
I have used reflection in a number of places. The main broad categories include:
Patterns wise, I'm not sure what the patterns are. A common thread between all the uses is reference by name and late binding - you want to bind to a member at runtime. This is often the case when you dynamically load assemblies and do not know the types of objeccts you need to create/manipulate.
Using reflection is powerful, but it wont make you more popular at parties. Only use it where the coupling is intentionally weak. So weak that you expect it to break at runtime. A great example is data binding in WPF.
I'm unsure about anti-patterns, but surely it would relate to doing things at runtime that should be done at compile time...