I\'ve implemented a class that looks like this interface:
[ImmutableObject(true)]
public interface ICustomEvent
{
void Invoke(object sender, EventArgs e)
Try this:
CustomEvent myEvent
public event EventHandler MyEvent {
add { myEvent = myEvent.Combine(value); }
remove {myEvent = myEvent.Remove(value); }
}
You can add and remove normal EventHandler delegates to it, and it will execute the add
and remove
accessors.
EDIT: You can find a weak event implementation here.
2nd EDIT: Or here.