gpt4 book ai didi

c# - 如何访问 PropertyChanged 事件的订阅者?

转载 作者:行者123 更新时间:2023-12-02 17:41:02 25 4
gpt4 key购买 nike

<分区>

在 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 的订阅者?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com