Hi, I need to extend the behavior of an instance, but I don't have access to the original source code of that instance. For example:
/* I don't have the source code for this class, only the runtime instance */
Class AB
{
public void execute();
}
in my code I would to intercept every call to execute, compute some sutff and then call the original execute, something like
/* This is how I would like to modify the method invokation */
SomeType m_OrgExecute;
{
AB a = new AB();
m_OrgExecute = GetByReflection( a.execute );
a.execute = MyExecute;
}
void MyExecute()
{
System.Console.Writeln( "In MyExecute" );
m_OrgExecute();
}
Is that possible?
Does anyone have a solution for this problem?