When using a delegate, I can use the Delegate.GetInvocationList () Method to get a list of delegate calls at runtime.
Is there a way to access the event subscriber list? I ran the code from this example (SO # 1237001) , and the immediate window allowed me to pass the SecondChange event to System.MultiCastDelegate, and then call the GetInvocationList method.
However, in my scenario, I work with System.Windows.Forms.DataGridView, and I would like to check the list of calls to the CellClick event at runtime. However, when I try to do some sorting on CellClick, I get the following error:
The event 'System.Windows.Forms.DataGridView.CellClick' can only appear on the left side of of + = or - =
I see that there are clearly differences in the announcements of these events. In the clock example, an event is declared as follows:
public event Func<DateTime, bool> SecondChange;
And in the DataGridView, the event is declared as follows:
[SRDescription("DataGridView_CellClickDescr"), SRCategory("CatMouse")]
public event DataGridViewCellEventHandler CellClick
{
add
{
base.Events.AddHandler(EVENT_DATAGRIDVIEWCELLCLICK, value);
}
remove
{
base.Events.RemoveHandler(EVENT_DATAGRIDVIEWCELLCLICK, value);
}
}
Why can I call GetInvocationList using the Clock example, but not in the DataGridView event? Is there a way to get the same type of information from the DataGridView event returned by GetInvocationList?
source
share