I can get the method body quite easily using reflection
Type type = assembly.GetType("Lorem.Ipsum.Dolor.Sit");
MethodInfo methodInfo = type.GetMethod("Amet");
MethodBody methodBody = methodInfo.GetMethodBody();
How can I programmatically change the body of a method and save my changes back to disk?
source
share