Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何知道 DataTable 已经订阅了 OnRowChanged 或 OnColumnChanged 事件?我的应用程序中出现许多通知的问题?所以我想检查一下,只想订阅一次表??
在声明类之外,故意很难查看订阅的内容,因为这通常不是您需要知道的。
根据具体情况,要么在订阅时非常擅长跟踪,要么先取消订阅(如果您没有订阅,则不会执行任何操作):
foo.OnSomeEvent -= SomeHandler; foo.OnSomeEvent += SomeHandler;
只要处理程序和目标实例(对于非静态处理程序)相同,这将: