开发者

Unregister(this) unregisters this instance from everything?

开发者 https://www.devze.com 2023-03-29 13:55 出处:网络
I am using the mvvm light toolkit for a project and I used to explicitly unregister to all the types of messages each instanc开发者_开发百科e was registered to, like this:

I am using the mvvm light toolkit for a project and I used to explicitly unregister to all the types of messages each instanc开发者_开发百科e was registered to, like this:

Messenger.Default.Unregister<MessageType1>(this);
Messenger.Default.Unregister<MessageType2>(this);
...

But is this

Messenger.Default.Unregister(this);

giving me the same result if I want to unregister to everything ? (for example in the Cleanup method of a ViewModel) I would assume so, but I did not find any hard evidence that my assumption was right.

Thanks!


I browsed the source code for a moment, and it does appear that Messenger.Default.Unregister(this) will unregister the target object from any actions it registered previously.

0

精彩评论

暂无评论...
验证码 换一张
取 消