Filter by criterion only
changes.Where(p => Evaluate(p)).Subscribe(p => { // Do something });
But how could you make it so that you get the criterion value and n values after the criterion is fulfilled (and these n values do not have to match the evaluation criterion)?
- e.g. i would like to subscribe to a stream that returns on
Evaluate(p)and one value after that (and then starts to evaluatepagain)
Please take a look on SkipWhile and Take extension methods of IEnumerable. You can try following code:
Edit
New code to take all matching items from sequence with
nitems’ tail (without retrieving items repeatedly)