Why WeakReferences in RelayCommand?

落花浮王杯 提交于 2019-12-04 15:27:24

Here's an article from MSDN about weak vs. strong references: MSDN Goodness

Maybe, and I repeat maybe for this reason:

In MvvmLight logic, and in other mvvm style, the ViewModel is "link" to the view using the Locator. Now when in your xaml page move forward to next page Vm of previous page still live, using command weak give able to easy release the memory.

The second is simple for better controlling life of object letting the locator the only which holding reference of the Viewmodel hence the only can decide where and when release

I hope this may help you, I thing imho if a vm still live for a while isn't really important, and mainly when your software not use really huge size of memory. Alloc and dealloc affect badly affected the performance of software

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!