<分区>
在 Visual Studio 2013 中进行调试时,我想知道某个类(我们称它为 Publisher
)发布的事件 PropertyChanged
的订阅者数量实现 INotifyPropertyChanged
。
我研究了一下,发现这应该可以调用 GetInvocationList()
并计算返回数组中的元素。因此,我在我的代码中设置了一个断点,并尝试在立即窗口中的 Publisher
类的名为 publisher
的对象上调用它:
publisher.PropertyChanged.GetInvocationList()
但是,我收到此错误消息:
The event 'System.ComponentModel.INotifyPropertyChanged.PropertyChanged' can only appear on the left hand side of += or -=
我做的有什么问题吗?
如何访问 PropertyChanged
的订阅者?