What you question is called AOP:
Aspect-oriented programming. Spring .NET is a good framework for that. It's not possible to add custom code to a method, by using System.Reflection.Emit, but you can hook yourself into classes that are provided
by remoting to do AOP. But Spring .NET implements that under hood and you can just use it ![]()
A sample on how to do it on your own is found
here.
Edit: Spring is also available for JAVA - it actually comes from there. Just to answer your second question ![]()