I've been trying to approach this issue for a while now and I have not been able to find an answer. Basically, I have a certain method that, when called, actually executes another different method rather than the method itself which I assume needs me to modify to where the method's pointer is pointing.
Say this,
public class A : OtherRandomClass
{
protected void SomeMethod()
{
//code
}
}
public class B
{
public void OtherMethod()
{
//code that I want to execute when SomeMethod is called
}
}
I cannot modify class A's source unfortunately, but what I want to try to do is to make any calls to SomeMethod actually invoke OtherMethod while preventing SomeMethod itself from being invoked, I don't want to resort to swapping method bodies.
I am aware of just how much bad practice this is, but the framework I'm using is just plain stupid and I have no other choice.
Any approaches to this?
Edit: Found what I was looking for, thanks to anyone who attempted to help!