K
Kevin Cline
Why, oh why is it necessary to test an event for null before raising
it?
Why isn't that case handled automatically, instead of forcing
developers to write three lines of wasted boilerplate code every time
an event is raised:
if (SomethingChanged != null) // wasted code
{ // more waste
SomethingChanged(...)
} // more waste
instead of simply:
SomethingChanged(...)
Either the C# compiler or the CLR should handle the null case
automatically.
it?
Why isn't that case handled automatically, instead of forcing
developers to write three lines of wasted boilerplate code every time
an event is raised:
if (SomethingChanged != null) // wasted code
{ // more waste
SomethingChanged(...)
} // more waste
instead of simply:
SomethingChanged(...)
Either the C# compiler or the CLR should handle the null case
automatically.