A multicast delegate is a delegate that points to several methods. Multicast delegation is a mechanism that provides functionality to execute more than one method: there is a list of delegates maintained internally, and when the multicast delegate is invoked, the list of delegates is executed.
Questions tagged [multicastdelegate]
33 questions
79
votes
6 answers
Simple Delegate (delegate) vs. Multicast delegates
I have gone through many articles but I am still not clear about the difference between the normal delegates that we usually create and multicast delegates.
public delegate void MyMethodHandler(object sender);
MyMethodHandler handler = new…

A9S6
- 6,575
- 10
- 50
- 82
10
votes
3 answers
Call BeginInvoke on MulticastDelegate?
According to Jon Skeet, "You can only call BeginInvoke on a delegate which has a single target invocation."
Why is that? What's the real reason?
Note: For clarification (and because I made this mistake), I am talking about the BeginInvoke on…

richard
- 12,263
- 23
- 95
- 151
10
votes
4 answers
Is there a Delegate which isn't a MulticastDelegate in C#?
I think the answer is NO? If there isn't, why do we have separated Delegate and MulticastDelegate classes? Maybe it's again because of "some other .NET languages"?

Cheng Chen
- 42,509
- 16
- 113
- 174
9
votes
3 answers
Multicast Delegates must have a return type of void. Why?
Multicast Delegates must have a return type of void Otherwise it will throw an exception.
I want to know whats the reason behind it, what if multiple methods could have a same return type as of a delegate ?

samj28
- 267
- 2
- 4
- 10
8
votes
6 answers
Swift Language Multicast Delegate
I am trying to implement the multicast delegate functionality in Swift. In Objective C, we have this excellent implementation
https://github.com/robbiehanson/XMPPFramework/blob/master/Utilities/GCDMulticastDelegate.m
And I have just created this…

csotiriou
- 5,653
- 5
- 36
- 45
6
votes
2 answers
Use of multicast in C# multicast delegates
When is it useful to have multicast delegates over singlecast delegates?
I use delegates a lot, mainly coupled with C# lambdas, but I've never felt the urge to use the multicast aspect of C# delegates, ie I've never wanted to combine multiple…

Alex ten Brink
- 899
- 2
- 9
- 19
6
votes
1 answer
Why delegate types are derived from MulticastDelegate class why not it directly derive from Delegate class?
I have a very basic question regarding delegate types. I compared the memebers of Delegate and MulticastDelegate classes in object browser and I couldn't find any new additional member present in MulticastDelegate.
I also noticed that the Delegate…

Vijay
- 101
- 1
- 6
5
votes
3 answers
MulticastDelegate exception being thrown only in production environment
I have a very weird issue occurring only in production environment.
The exception has the message
"Delegate to an instance method cannot have null 'this'".
The method where the exception is being thrown is very simple, and worked for a long…
4
votes
3 answers
Signals and slots implementation in Delphi?
Does an implementation of the signals and slots mechanism for event dispatching exist for Delphi?

MX4399
- 1,519
- 1
- 15
- 27
4
votes
3 answers
How to handle exception in multicast delegate in C#?
I've been given some code that I am calling through multicast delegate.
I would like to know how I can catch up and manage any exception raised there and that is not managed for the moment. I cannot modify the code given.
I've been looking around…

Goul
- 573
- 2
- 5
- 16
4
votes
2 answers
Multicast Delegate Ambigous
I have below code
StringOperations sumString, reverseString, lowerString, upperString, multicastString;
sumString = new StringOperations(sum);
reverseString = new StringOperations(reverse);
lowerString = new…

Junaid
- 2,572
- 6
- 41
- 77
4
votes
2 answers
C# Delegate -- How to Bind a Delegate with multiple functions with different parameters first (same type) and then Fire/Invoke them later?
I need a C# Delegate to bind with multiple functions with different parameters first (same type) and then Fire/Invoke them later.
Please see my example below :
(Please note that my actual requirement is a lot more complex , but the same principle…

Uday Mehta
- 109
- 2
- 13
3
votes
1 answer
Code is compiled and run successfully but expected output is to print "Sub" is not getting printed. What is the error in this code?
What is the problem in this code?
namespace ConsoleApplication1
{
public delegate void del();
class Program
{
static void Main(string[] args)
{
del d = new del(add);
d += sub;
}
public static void add()
{
…

Asad Patel
- 111
- 5
3
votes
3 answers
Using MulticastDelegate as parameter while avoiding DynamicInvoke
I have a MulticastDelegate that can reference one of a number of (legacy) delegates that have the same signature. For example:
public delegate void ObjectCreated(object sender, EventArgs args);
public delegate void ObjectDeleted(object sender,…

Kaleb Pederson
- 45,767
- 19
- 102
- 147
2
votes
1 answer
Removing All instances of specific delegate from multicast delegates
Note: I'm writing this to have documented answers on my question because I frequently find myself having to manually research this
I'm looking for an efficient deterministic way to remove all instances of a delegate from a multicast delegate. Take…

johnny 5
- 19,893
- 50
- 121
- 195