c# - Should I be calling Dispose on Reactive Extensions (Rx) Subject -
c# - Should I be calling Dispose on Reactive Extensions (Rx) Subject<T> -
i using reactive extensions (rx) subject direct replacement c# events so:
public class myclass { private subject<string> subject; public iobservable<string> whensomethinghappened { { homecoming this.subject.asobservable(); } } private void onsomethinghappened(string something) { this.subject.onnext(something); } }
note never phone call oncompleted on subject. should myclass implementing idisposable , calling this.subject.dispose? mean implementation using subject should implement idisposable.
the reason inquire idisposable pattern bit disease, if 1 thing implements it, uses has implement too.
nope, don't need this. when worrying memory usage , lifetimes, think disposing subscriptions, not subjects.
c# .net system.reactive
Comments
Post a Comment