Is it safe to add delegates to events with keyword new?

后端 未结 4 443
时光取名叫无心
时光取名叫无心 2021-01-12 20:02

One thing I am concerned with is that I discovered two ways of registering delegates to events.

  1. OnStuff += this.Handle;
  2. OnStuff += new StuffEventHand
4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-12 20:54

    If I remember correctly, the first alternative is merely syntactic sugar for the second.

提交回复
热议问题