How can I programatically (using reflection?) change a method body and save my changes back to disk

Posted by Jeffrey LeCours on Stack Overflow See other posts from Stack Overflow or by Jeffrey LeCours
Published on 2010-05-14T19:04:29Z Indexed on 2010/05/14 19:14 UTC
Read the original article Hit count: 311

Filed under:
|
|

I can get at the method body easily enough using reflection

Type type = assembly.GetType("Lorem.Ipsum.Dolor.Sit");
MethodInfo methodInfo = type.GetMethod("Amet");
MethodBody methodBody = methodInfo.GetMethodBody();

How can I programatically change the method body and save my changes back to disk?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#