Asynchronous Multicast Delegates

asynchronous, c#, delegates, events, multithreading

Solution

`GetInvocationList` just returns an array of type `Delegate` which doesn't know the appropriate signature. However, you can cast each returned value to your specific delegate type:

foreach (MyDelegate action in multicast.GetInvocationList())
{
    action.BeginInvoke(...);
}

Problem

I've been doing some work lately on a project that makes extensive use of events. One of the things that I need to do is asynchronously call multiple event handlers on a multicast delegate. I thought the trick would be to call BeginInvoke on each item from GetInvocationList, but it appears as though BeginInvoke doesn't exist there. Is there a way to do this or do I need to start using ThreadPool.QueueUserWorkItem and sort of roll my own solution that way?

Original source