简体   繁体   中英

Is a Multicast Delegate Immutable?

Is a multicast delegate immutable or mutable? Also one more question: is a multicast delegate implemented based on singleton or multiton pattern?

Yes, delegates are immutable. Combining or removing delegates creates a new instance that contains one or more delegates. Delegate references are shared across threads, so there's no threading model to consider. Some frameworks require the delegate to execute in the originating thread, though, so be careful of that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM