Skip to content

How to make list and cache disposal more fluent? #891

Closed Answered by JakenVeina
glen-nicol asked this question in Q&A
Discussion options

You must be logged in to vote

Maybe I'm missing something in your scenario

I was indeed missing something. .AsObservableList() returns an IObservableList<> which is IDisposable, so yeah, you do potentially need to handle disposal of that. Practically speaking, you could just... not. Disposing them won't really do anything important, the .Switch() will take care of cleanup of the subscriptions, and that's all that's really important.

But the truth is, it doesn't even matter. Because you can, in fact, just get rid of .AsObservableList() completely there, and then nothing disposable gets created in the first place

service
    .StateOverTime()
    .Select(t => CreateVms(t)
        .ToObservable()
        .ToObservableCh…

Replies: 5 comments 7 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@JakenVeina
Comment options

@JakenVeina
Comment options

Answer selected by glen-nicol
@glen-nicol
Comment options

Comment options

You must be logged in to vote
4 replies
@glen-nicol
Comment options

@JakenVeina
Comment options

@glen-nicol
Comment options

@JakenVeina
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants