This little tweet turned up this morning in response to Mike Taulty wanting“the ability to fire an event without having to check it for null”.
richardblewett @mtaulty you can use the null pattern for this Mike, just do = delegate{}; on the event declaration |
It’s pretty obvious when you think about it tho’...
public event EventHandler CriteriaChanged = delegate{};
Easy-peasey.
Update: Richard credits Andy Clymer the original idea (see comments). How far will the chain go?!