Can I reverse the order of a multicast delegate event?

前端 未结 3 2154
耶瑟儿~
耶瑟儿~ 2021-02-19 19:21

When you subscribe to an event in .NET, the subscription is added to a multicast delegate. When the event is fired, the delegates are called in the order they were subscribed.<

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-19 19:39

    One option would be to handle this when you raise the event. You can get the event subscribers via Delegate.GetInvocationList, and just call each delegate in reverse order yourself.

提交回复
热议问题