在Visual Studio 2013中进行调试时,我想知道由实现INotifyPropertyChanged
的某个类(称为Publisher
)发布的事件PropertyChanged
的订阅者数量。如何访问PropertyChanged事件的订阅者?
我研究了一下,发现这应该可以调用GetInvocationList()
并计算返回数组中的元素。所以我在我的代码中设置断点,并试图把这种立即窗口称为Publisher
类publisher
的对象上:
publisher.PropertyChanged.GetInvocationList()
不过,我得到这个错误信息:
The event 'System.ComponentModel.INotifyPropertyChanged.PropertyChanged' can only appear on the left hand side of += or -=
我做了什么错? 我如何访问PropertyChanged
的用户?
http://stackoverflow.com/a/1129530/736079 – jessehouwing
根据您尝试调试的问题,内存分析器可能会告诉你你需要什么。 –