Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WhenAnyObservable overloads that combine latest #1189

Merged

Conversation

kentcb
Copy link
Contributor

@kentcb kentcb commented Nov 1, 2016

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

Feature.

What is the current behavior? (You can also link to an open issue here)

The WhenAnyObservable operator does not work in the same fashion as other WhenAny* operators. All observables must be the same type, and the resulting observable sequence is the result of a Merge of those observables. Consider this:

public IObservable<bool> First { ... }

public IObservable<bool> Second { ... }

public IObservable<string> Third { ... }

// elsewhere
this
    .WhenAnyObservable(x => x.First, x => x.Second)
    .Select( /* er, umm, how do I distinguish whether the value came from First or Second? */ )

// somewhere else
this
    .WhenAnyObservable(x => x.First, x => x.Third)  // oops, this is not even possible

What is the new behavior (if this is a feature change)?

This PR adds overloads of WhenAnyObservable that work in the same fashion as other WhenAny* operators. Each observable can be of a different type, and a selector must be provided to combine the results. In our example above, it would look like this:

this
    .WhenAnyObservable(x => x.First, x => x.Second, (first, second) => /* do whatever here to select an appropriate value */)

this
    .WhenAnyObservable(x => x.First, x => x.Third, (first, third) => /* do whatever here to select an appropriate value */)

Does this PR introduce a breaking change?

No.

Please check if the PR fulfills these requirements

@ghuntley
Copy link
Member

ghuntley commented Nov 1, 2016

LGTM

@ghuntley ghuntley merged commit b418df6 into reactiveui:rxui7-master Nov 1, 2016
@ghuntley ghuntley modified the milestone: 7.0.0 Nov 6, 2016
@lock lock bot locked and limited conversation to collaborators Jun 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants