Should i dispose IScheduler.Schedule subscription mannualy to avoid memory leaks?

元气小坏坏 提交于 2019-12-11 18:04:18

问题


In my project i have to call RxApp.MainThreadScheduler.Schedule(() => ...) Should I dispose subscription mannualy by adding DisposeWith(DisposableOnDestroy) or it automatically called by destructor?

I have read ReactiveUI recomendations, but did not find answer

RxApp.MainThreadScheduler.Schedule(() => this.RaisePropertyChanged(statisticName))

回答1:


No, only Dispose if you want to cancel a queued operation early. Also, what you're trying to do with RaisePropertyChanged here will eventually make your app extremely slow once it gets bigger.



来源:https://stackoverflow.com/questions/58026600/should-i-dispose-ischeduler-schedule-subscription-mannualy-to-avoid-memory-leaks

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