Delegate Targets

fremag edited this page Dec 3, 2016 · 3 revisions

From the main Delegates module, you can display all instances of a type inheriting from MultiCastDelegate:

  • "Targets" : the number of elements in the delegate invocation list
  • "Field Name" : if the delegate instance is a referenced by an instance, this column will display the field and type name

In this example, instances of type "MyIntDelegate" are members of type "ClassWithEventHandlers" in a field named "FirstEventHandler". Have a look at the code where the dump comes from :

public class ClassWithEventHandlers
   public delegate int MyIntDelegate(int x, int y);
   public delegate void MyVoidDelegate(string s);
   public event MyIntDelegate FirstEventHandler;
   public event MyVoidDelegate SecondEventHandler;

Then double click on a instance to display informations about the delegate's invocation list elements ("Targets"):

In this example, the delegate instance has only one "target":

  • Type: FirstCallBacks
  • Method: MyFirstCallBack

Once again, it's consistent with the code :

var obj = new ClassWithEventHandlers();
var firstCallBack = new FirstCallBacks();
var secondCallBack = new SecondCallBacks();
obj.FirstEventHandler += firstCallBack.MyFirstCallBack;
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.