Click here to Skip to main content
15,884,080 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
Why Multicast Delegate Only Support Void Return Type Only?
Posted

Because they are multicast, calling more than one method. Which return value would you use? How would you combine them (that is, how would the framework combine them)?

You can't use ref or out arguments either, for the same reason.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 28-Jan-11 4:00am    
A 5. That is my idea, too - please see my answer.
Very good note about ref and out -- all the combinations are just to hard to generalize, so why bother?
--SA
Indivara 28-Jan-11 4:04am    
Yes, I saw your answer... eagerly awaiting your article :)
Sergey Alexandrovich Kryukov 28-Jan-11 12:42pm    
Thank you. It will take some time.
--SA
Probably I will try to answer in more detail a little later, but I'll give the basic explanation right now.

Here is why: I'm writing and article on dynamic method dispatcher which will features return from all the elements of the invocation list. To allow every individual delegate element to return its individual return value I had to present the result of invocation as an array composed of all the individual return values. Can you see the idea?

I think that the developer of multicast delegate found this feature redundant (frankly, I don't see very important use cases for such feature myself). The simplification means not having a return value of invocation chain at all — hence void.

—SA
 
Share this answer
 
Comments
Sandeep Mewara 28-Jan-11 4:29am    
Do you sleep? :)
Or you answer while sleeping? :)
Sergey Alexandrovich Kryukov 28-Jan-11 12:46pm    
Yes, a lot; no, I don't. I already answered else where -- thanks.
--SA
Sergey Alexandrovich Kryukov 29-May-11 23:20pm    
Sandeep, I just published this article, please see:

Dynamic Method Dispatcher,
http://www.codeproject.com/KB/dotnet/DynamicMethodDispatcher.aspx
--SA
Sandeep Mewara 30-May-11 1:59am    
SA the URL is incorrect. It takes me to 404.
It worked now. Sorry for confusion! :)
Espen Harlinn 30-Jan-11 17:30pm    
Good answer(5+)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900