3 ms·
The locking bit on events is wrong certainly for C#v4 (see http://blogs.msdn.com/b/cburrows/archive/2010/03/30/events-get-a-little-overhaul-in-c-4-afterward-eff
by peteri 15y ago
The locking bit on events is wrong certainly for C#v4 (see http://blogs.msdn.com/b/cburrows/archive/2010/03/30/events-get-a-little-overhaul-in-c-4-afterward-effective-events.aspx http://blogs.msdn.com/b/cburrows/archive/2010/03/30/events-g... and the other entries in the series) for why.
Also I've nearly always done the first pattern on Chris Burrows page, although Jon Skeet recommends differently on his multi-threading event page http://www.yoda.arachsys.com/csharp/threads/lockchoice.shtml http://www.yoda.arachsys.com/csharp/threads/lockchoice.shtml which (I think but I must ask him) is really more about avoiding the lock(this).