如何知道Datatable已经被订阅?
如何知道 DataTable 已经订阅了 OnRowChanged 或 OnColumnChanged 事件? 我的应用程序中遇到了许多通知的问题?所以我想支票并只想订阅一次表?
How to know that DataTable is already subscribed to OnRowChanged or OnColumnChanged events ?
I am facing a issue with many notifications in my app ? so I wanted to put a check and want to subscribe table only once ??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在声明类之外,查看订阅的内容是故意棘手的,因为这通常不是您需要知道的事情。
根据具体情况, 要么在您订阅时非常善于跟踪,要么首先简单地取消订阅(如果您没有订阅,则不会执行任何操作):
只要 <处理程序和目标实例(对于非静态处理程序)是相同的:
Outside of the declaring class it is deliberately tricky to see what is subscribed, since that is generally not something you need to know.
Depending on the scenario, either get very good at tracking when you subscribe, or simply unsubscribe first (which does nothing if you aren't subscribed):
As long as the handler and target-instance (for non-static handlers) is the same this will: