I think some code using reflection can be optimized (I'm not sure we can call it optimize) at compile time.
For example,
System.Reflection.MethodInfo.GetCurrentMethod
always returns the same value when it is called in the same method.Also, accessing a class info using class name represented constant string has no reason to be done at run time.
I have tested it and I got a result that shows a code with reflection is about 300x slower than one without reflection.
Are there any compile option(s) that enable what I want?