Possible Duplicate:
What is the “cost” of reflection?
Does anyone have a good explanation of the generally accepted mantra that reflection == bad performance
?
For example, how expensive is it to iterate over a type's properties collection and extract all property values from an instance of this type compared to just accessing all the properties directly? One level of magnitude? Two? What does it depend on? Is it predictable at all? What is happening under the hood?
EDIT: Thanks for the answers so far. I've looked into some the links you provided and it seems that there is a vast gap of estimates out there regarding Reflection on Properties compared to direct access: from 2.5 times slower to 200 times slower.
This does not seem very reasonable to me. Some of you mentioned performance improvements in later versions of .Net so let be narrow my question to .Net 4.0. Does anyone have any benchmarks for that?