The problem with Multi-Cast Delegates

My blog has moved.
You can view this post at the following address:
http://www.osherove.com/blog/2004/3/27/the-problem-with-multi-cast-delegates.html
Published Saturday, March 27, 2004 10:01 PM by RoyOsherove
Filed under:

Comments

Saturday, March 27, 2004 8:10 PM by Steve Maine

# re: The problem with Multi-Cast Delegates

If you wanted to implement delegate chaining, you could type your methods as returning void and accumulate the return values in a ref parameter.
Sunday, March 28, 2004 12:13 PM by Duncan Godwin

# re: The problem with Multi-Cast Delegates

You can using the GetInvocationList on the delegate, and get the reslt for each. Have a look at:

if( completed != null ) {
foreach( WorkCompleted wc in completed.GetInvocationList() ) {
int grade = wc();
Console.WriteLine("Worker grade= " + grade);
}
}

Sourced from http://www.sellsbrothers.com/writing/default.aspx?content=delegates.htm / Harvesting the Results.
Monday, March 29, 2004 12:16 PM by Ohad

# re: The problem with Multi-Cast Delegates

One thing you need to remember is that the order of invocation is not guaranteed by Microsoft and can be changed in future version of .net i.e. the internal implementation can be changed.
Monday, March 29, 2004 4:13 PM by Roy Osherove

# re: The problem with Multi-Cast Delegates

Oahd: yep. I should have included that.
Duncan: yep, I can, but that was not my point. my point was that if someone wanted to, this could not be avoided by the class designer.