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 RefCount overloads with minimum observer count option #1104

Merged
merged 4 commits into from
Dec 5, 2019

Conversation

akarnokd
Copy link
Collaborator

@akarnokd akarnokd commented Dec 4, 2019

This PR adds overloads to the RefCount operator that allows specifying the minimum number of observers to subscribe to it before the connection is established.

The change is trivial in the operator replacing the original constant representing one observer with an operator parameter.

var source = Observable.Range(1, 5).Publish().RefCount(2);

source.Subscribe(Console.WriteLine);
Console.WriteLine("No values should be printed yet");
source.Subscribe(Console.WriteLine);

prints

No values should be printed yet
1
1
2
2
3
3
4
4
5
5

Resolves #406

@danielcweber danielcweber merged commit b3f3dc2 into dotnet:master Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Minimum subscribers for RefCount
2 participants