System.Timers.Timer:获取附加事件。 [英] System.Timers.Timer: Get attached events.

查看:106
本文介绍了System.Timers.Timer:获取附加事件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取附加到Elapsed of System.Timers.Timer类实例的事件?

解决方案

你不能,或者至少你不应该能够 - 因为事件列表在私人成员中。但您可以进行调试: http://stackoverflow.com/questions / 660480 /确定事件处理程序绑定事件列表 [ ^ ]



我不会尝试在生产代码中使用它: private 属性意味着.NET团队可以随时改变其工作方式 - 因此它可以完全停止工作。

How to get events i attached to Elapsed of System.Timers.Timer class instance?

解决方案

You can't, or at least you shouldn't be able to - as the events list are in a private member. But you can for debug purposes: http://stackoverflow.com/questions/660480/determine-list-of-event-handlers-bound-to-event[^]

I would not try to use this in production code: the private attribute means that the .NET team are at liberty to change anything about the way this works at any time - so it could well stop working for no reason at all.


这篇关于System.Timers.Timer:获取附加事件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆