Replies: 1 comment 2 replies
-
Folks will usually tell you to avoid side-effects in RX streams, and it's good advice, but that's essentially what you want here. If you have multiple steps of work to complete, and you can't just do all the work within a single direct subscription, you can either build your pre-requisite work int your observable stream, as side-effects, or you can initiate an entirely new downstream. var consumableStream = items
.ObserveCollectionChanges()
.Do(e =>
{
//do stuff based on e.EventArgs.Action
});
// You can now hand-off consumableStream to be subscribed to by whoever else needs to do work, after your processing in .Do() is done. using var changesProcessed = new Subject<Unit>();
using var itemsSubscription = items
.ObserveCollectionChanges()
.Subscribe(e =>
{
//do stuff based on e.EventArgs.Action
changesProcessed.OnNext(Unit.Default);
});
// You can now hand-off changesProcessed to be subscribed to by whoever else needs to do work, after your processing in .Subscribe() is done. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm getting started wiht DynamicData and In my code i have a collection of items
ReadonlyObservableCollection<T> items;
and subscribe to changes to that collection to react on the specific changes like this
I wanted to know if there is a way to get notified once the CollectionChanges are completed? Is this something that is built-in to DynamicData?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions