Delegate Targets - fremag/MemoScope.Net GitHub Wiki
From the main Delegates module, you can display all instances of a type inheriting from MultiCastDelegate: /img/MemoScope_Delegates_Instances.gif
- "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"):
/img/MemoScope_Delegates_Targets.gif
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;