c# - Why does Subject<T>.Dispose does not dispose current suscriptions? -


hi i've been thinking time subject<t> disposes subscriptions based on if manually call dispose method. i've found doesn't work way, clears inner collection of observers , substitutes disposedobserver helper class instance.

i found myself little confused behaviour, assumed "normal" propagate , dispose suscribers. later, trying figure out why designed way, guessed couple of reasons why designed way.

  • the suscriber may composition depents partially on subject , full propagation of disposal doesn't make sense. ie. merge not disposed because 1 of sources disposed, expects.
  • subject.dispose semantically equivalent continuation observable.never side of observer. subject.dispose caller can call oncomplete or onerror if wanted signal error or completion before disposal (because on same scope).

edit note: sorry unclear question. understand how use it, more design question. let me state more clearly.

why think designers of rx made dispose behaviour way?

(the 2 points above answer trial)

a subject should indicate done sending oncomplete or possibly onerror. idiomatically , grammatically correct rx. subscribers responsible ending subscriptions disposing them. should write observables such clean resources once "done" if subscribers have not unsubscribed.


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -