On 06/03/2015 12:42, Edward Ned Harvey (mono) wrote:
From: mono-devel-list-boun...@lists.ximian.com [mailto:mono-devel-list- boun...@lists.ximian.com] On Behalf Of Federico Di Gregorio
[snip]
I agree that the pattern you've suggested is the better pattern, to avoid NullReferenceException in a race condition. I don't see anything "official" out there suggesting this pattern; in fact, all the example code I see from msdn and elsewhere uses the former pattern. Your post is the first time I've heard of the new pattern, and I'm going to use it from now on. Hopefully nobody objects to the suggested new pattern, and hopefully those changes are acceptable, but if not, maybe you can find something official suggesting the new pattern.
I found references to this pattern in so many places (books, articles, blogs, SO answers) that I thought it was canon: it never occured to me to check for an official source. Anyway, if you're interested here are two interesting posts about it:
http://blogs.msdn.com/b/ericlippert/archive/2009/04/29/events-and-races.aspx http://codeblog.jonskeet.uk/2015/01/30/clean-event-handlers-invocation-with-c-6/ Ciao, federico -- Federico Di Gregorio federico.digrego...@dndg.it Di Nunzio & Di Gregorio srl http://dndg.it Non vi sono certezze, solo opportunità . -- V _______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list