In Java, we used the javaagent argument and the ASM utilities (http://asm.ow2.org/) to change the byte code when starting / loading in memory by the class loader. (otherwise add a method call to the method in the class dynamically).
As an example, you can remove all Log4j calls to speed up the application (http://surguy.net/articles/removing-log-messages.xml).
I am trying to figure out how to do the same process at runtime with C # /. Net. I saw that you can manipulate CIL for .Net, but I have not found an example of this at runtime.
System.Reflection.Emit seems to be the closest .Net equivalent to where you can dynamically create classes, but is there a way to add or override existing classes using this?
James source share