Directly find invocation location of callback

In my project I have this pattern a lot -

void DoSomething() {

}

void Initialize() {

OnSomethingHappened += DoSomething;

}

void Process() {

OnSomethingHappened();

}

When I'm in the method DoSomething() and I want to see where it is being invoked, I need to first find references to DoSomething() which takes me to Initialize() where the event is being wired, and then look for references to OnSomethingHappened() to see where it is being invoked, which will lead me to the Process() method.

Is there a way to directly get to the Process() method from the DoSomething() method? I realize that only at runtime can we determine what callback will actually get invoked, but it would be nice to get the list of possible locations from which a method can be invoked.

Please sign in to leave a comment.