rehansaeed.github.io
rehansaeed.github.io copied to clipboard
[Comment] Reactive Extensions (Rx) - Part 4 - Replacing Timers
https://rehansaeed.com/reactive-extensions-part4-replacing-timers/
Michael Khalsa commented on 2018-04-19 01:33:58
Nice series, thanks!
Question about the timer example: Is it best practice to add on .Dispose to the subscriber to have it cleanup (assuming yes), or will this happen automatically when the method completes. (showed example in vb)
Observable
.Timer(TimeSpan.FromMilliseconds(intervalMs))
.ObserveOn(Threading.SynchronizationContext.Current)
.Subscribe(Function(x) StatusBar.Panels("statusPanelHeartbeat").Visible = False,
Function(x) StatusBar.Panels("statusPanelHeartbeat").Visible = False)
.Dispose()
Muhammad Rehan Saeed commented on 2018-04-19 09:16:59
Nice series, thanks!
Question about the timer example: Is it best practice to add on .Dispose to the subscriber to have it cleanup (assuming yes), or will this happen automatically when the method completes. (showed example in vb)
Observable .Timer(TimeSpan.FromMilliseconds(intervalMs)) .ObserveOn(Threading.SynchronizationContext.Current) .Subscribe(Function(x) StatusBar.Panels("statusPanelHeartbeat").Visible = False, Function(x) StatusBar.Panels("statusPanelHeartbeat").Visible = False) .Dispose()
Here is a really good explanation:
https://stackoverflow.com/questions/7703366/reactive-observable-subscription-disposal
Michael Khalsa commented on 2018-04-22 00:29:47
Here is a really good explanation:
https://stackoverflow.com/questions/7703366/reactive-observable-subscription-disposal
Thank you.
It was necessary to remove the .Dispose in this case to make it work correctly.