Adding Multiple delegates to a invocation List

Hi friends,

This is the continuation of 1st part of delegates where in i have explained the basics of delegates, and how to work with that. But, let’s suppose i have multiple delegates and i have to add the same in invocation list, then how would i do that. so, let’s get started. 1st of all i would add one more delegate and it’s corresponding method in the program, so that i can add multiple in the list.

Delegates7 Delegates8


then, inorder to add the multiple delegates in the invocation list i would need to modify the above code as in



so, this will produce the below result. so, basically, now del1 is now appended with del2 and del3 as well and hence producing the collective result. also, one more point to notice here, that this method call is synchronous means it gets invoked as it is declared.




so, this is basically an example that how multicast delegate works behind the scene and it makes it really easy to have one and point of reference to invoke multiple subscribers. so, with i would like to wrap. Till then stay tuned and happy coding.

Happy Coding