Delegate & Event

来源:互联网 发布:古天乐小学 知乎 编辑:程序博客网 时间:2024/05/22 23:45

A delegate is a reference type, like the other reference types you've seen in this book, but instead of referring to an object, a delegate refers to a method. This is called encapsulating the method. When you create the delegate, you specify a method signature and return type; you can encapsulate any matching method with that delegate.

 

 

 

Events enable a class or object to notify other classes or objects when something of interest occurs. The class that sends (or raises) the event is called the publisher and the classes that receive (or handle) the event are called subscribers.

 

原创粉丝点击