Skip to content

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