Asynchronous Multicast Delegates

后端 未结 1 1090
生来不讨喜
生来不讨喜 2021-02-13 11:06

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 multic

1条回答
  •  失恋的感觉
    2021-02-13 11:36

    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(...);
    }
    

    0 讨论(0)
提交回复
热议问题