static void Main(string[] args) { var l_dependent = new Dependent(); SomethingHappened(null, EventArgs.Empty); l_dependent.Dispose(); SomethingHappened(null, EventArgs.Empty); }
static void Main(string[] args) { var l_dependent = new Dependent(); SomethingHappened(null, EventArgs.Empty); l_dependent.Dispose(); // This call will cause the disposed object // (which is still registered to the event) // to thrown an exception. SomethingHappened(null, EventArgs.Empty); }