什么是MulticastDelegate与异步调用

来源:百度知道 编辑:UC知道 时间:2024/05/25 21:08:09
什么是MulticastDelegate与异步调用

MulticastDelegate:多播委托。它是委托最令人兴奋的特性之一。简单地说,多播委托就是允许创建方法的调用列表或链表的能力。这种链表很容易创建:初始化一个委托,然后用“+”或“+=”运算符为链表添加方法(“-”,“-=”)

这是原文:
One of the most exciting features of a delegate is its support for multicasting. In simple terms, multicasting is the ability to create an invocation list, or chain, of methods that will be automatically called when a delegate is invoked. Such a chain is very easy to create. Simply instantiate a delegate, and then use the + or += operator to add methods to the chain. To remove a method, use − or − =. If the delegate returns a value, then the value returned by the last method in the list becomes the return value of the entire delegate invocation. Thus, a delegate that will make use of multicasting will usually have a void return type.