Replies: 1 comment
-
首先,OR 是有 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Messenger在wpf中一个常见应用场景是VM1中的某个属性A发生了改变,需要通知发送到VM2,因为A可能是在View1/VM1进行修改,然后在View2/VM2进行同步展示。那现在我的写法是在A的set方法里加入WeakReferenceMessenger.Default.Send()发送消息语句,这样每次A修改,都会发送一次到VM2,在VM2中ASub属性负责接收该消息。
我的问题是:自从第一次A发送出去后,在VM2中ASub已经得到了A的引用,那这样理论来说,不用每次A发生改变都要发送,因为A修改了引用里的内容,那ASub指向的引用一样也改变了。之所以提出这个问题,是因为我感觉每次发送这样效率比较低。 不知道我的这种理解有没有什么问题,或风险。
Beta Was this translation helpful? Give feedback.
All reactions