Suppose I have the following .NET classes:
public class C
{
public void M()
{
....
}
}
and
public class
There are mainly two possible approaches - proxying the objects or hooking the calls.
Proxying can be done using Castle Dynamic Proxy or any similar dynamic proxy framework. Hooking the calls can either be done with aspect oriented programming with something like PostSharp or even by black magic like done by Isolator (it is designed for unit testing but it can probably be (ab)used like all other technologies)