Practice mode C#

When a multicast delegate with a return value invokes several methods, what value does the call return?

Correct answer C. The return value of the last method in the invocation list

Explanation

A multicast delegate calls each method in its invocation list in order. When the delegate type returns a value, only the result of the last method is returned and earlier results are discarded. To collect every result, iterate over GetInvocationList() and invoke each delegate yourself. This is one reason event handlers usually return void.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.