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

CountChanged not working on SourceCache #188

Closed
andrewalex opened this issue Dec 14, 2018 · 4 comments
Closed

CountChanged not working on SourceCache #188

andrewalex opened this issue Dec 14, 2018 · 4 comments
Labels

Comments

@andrewalex
Copy link

I seem to be struggling getting SourceCache CountChanged to properly report

A simple example:

	public static void Main()
	{
		SourceCache<string, string> sc = new SourceCache<string, string>(x => x);
		
		sc.CountChanged.Subscribe(x => Console.WriteLine("sub" + x));
		sc.AddOrUpdate("1");sc.AddOrUpdate("2");sc.AddOrUpdate("3");sc.AddOrUpdate("4");
		Console.WriteLine(sc.Count);
		Console.WriteLine("Done");
	}

@RolandPheasant
Copy link
Collaborator

The fix has been deployed to Nuget v6.7.1

@sa-he
Copy link

sa-he commented Mar 6, 2019

Current Nuget v6.8.0.* contains a similar error-scenario when using this code:
I'd like to use this syntax instead of "sc.CountChanged", for I'd like to apply a .Filter() just before Count()

        var sc = new SourceCache<string, string>(x => x);
        sc.Connect().Count().Subscribe(x => Console.WriteLine("sub" + x));
        // sc.Connect().Filter(....).Count().Subscribe(x => Console.WriteLine("sub" + x));
        sc.AddOrUpdate("1"); sc.AddOrUpdate("2"); sc.AddOrUpdate("3"); sc.AddOrUpdate("4");
        Console.WriteLine(sc.Count);
        Console.WriteLine("Done");

@RolandPheasant
Copy link
Collaborator

Have you added the aggregation namespace:

using DynamicData.Aggregation;

@sa-he
Copy link

sa-he commented Mar 7, 2019

No, intellisense suggested this namespace first:

using System.Reactive.Linq;

Thank you - it works using DynamicData.Aggregation namespace.

@lock lock bot added the outdated label Jul 9, 2019
@lock lock bot locked and limited conversation to collaborators Jul 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants