The C# events implementation (articles vs reflector)

前端 未结 3 980
自闭症患者
自闭症患者 2021-02-10 09:12

public class EventsType { public event EventHandler> NewEvent;

    public void SmthHappened(string data)
    {
        MyEventArgs even         


        
      
      
      
3条回答
  •  隐瞒了意图╮
    2021-02-10 09:44

    What you are expecting is a simple non thread safe implementation. The field like event syntax always provide thread-safe syntax (hence the reflector version). Refer this artcile for understanding events & how they get implemented.

提交回复
热议问题