Reputation: 65
I am trying to use WhenAny (Reactive UI) for the first time.
When a Identifier =="xyz" and a IsMax field get changes, want to set a local value to true in the subscribe,
this.WhenAny(x => x.IsMax, x => x.Value)
.Subscribe(x =>
{
if (Identifier == "xyz")
{
isOk = true;
}
});
but is there any other way to merge Identifier condition as well?
Upvotes: 2
Views: 2257
Reputation: 8843
I'm not familiar with ReactiveUI, but if it uses the same IObservable as Reactive Extensions, then you could do this:
this.WhenAny(x => x.IsMax, x => x.Value)
.Where(_ => Identifier == "xyz")
.Subscribe(_ =>
{
isOk = true;
});
Is this what you wanted?
PS.: I should have asked this in a comment, but I haven't got enough reputation yet.
Upvotes: 4