我应该手动处理 IScheduler.Schedule 订阅以避免内存泄漏吗?

我应该手动处理 IScheduler.Schedule 订阅以避免内存泄漏吗?

问题描述:

在我的项目中,我必须调用 RxApp.MainThreadScheduler.Schedule(() => ...)我应该通过添加 DisposeWith(DisposableOnDestroy) 手动处理订阅还是由析构函数自动调用?

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?

我已阅读 ReactiveUI 推荐,但没有找到答案

I have read ReactiveUI recomendations, but did not find answer

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

否,仅当您想提前取消排队操作时才处置.此外,您在此处尝试使用 RaisePropertyChanged 进行的操作最终会使您的应用程序变大后变得极其缓慢.

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.