用于事件.NET的代表?事件、代表、NET

2023-09-03 21:17:28 作者:帅的不敢上厕所

我有点困惑,我知道代表是像函数指针,它们被用来传递函数作为参数传入的方法。

I'm little confused, I know that delegates are like function pointers, and they are used to pass a function as a parameter into a method.

这是如何配合到事件模型?

How does that fit into the event model?

电话:

myButton.OnClick += new .....();

时在内部正好传递方法/函数为在事件发生时,所有的订阅者通知有关该事件的参数

Is that internally just passing the method/function as a parameter when the event occurs and all the subscribers are notified about the event?

推荐答案

有一个在此

好奇心是福