I was wondering if this actually worked ?
private void RegisterKeyChanged(T item)
{
item.OnKeyChanged += (o, k) => ChangeItemKey((T)o, k);
}
private void UnRegisterKeyChanged(T item)
{
item.OnKeyChanged -= (o, k) => ChangeItemKey((T)o, k);
}
How does the compiler know that the event handlers are the same ? Is this even recommended?
There’s an MSDN page that talks about this:
How to Subscribe to and Unsubscribe from Events
Note in particular:
And also: