This project has moved and is read-only. For the latest updates, please go here.

DictionarySubject initial snapshot

Topics: General, Reactive (Rx)
May 16, 2012 at 4:29 PM


Is it possible to use DictionarySubject and receive the initial snapshot as a series of CollectionNotification.Add messages instead of a single Exists message?

This way I can treat the whole stream of notifications in the same manner (several .Where filters) and dont need specific processing to handle the exists message.

many thanks for the great library

Jul 31, 2012 at 6:41 PM
Edited Jul 31, 2012 at 6:43 PM


That was our original design for a method called View, but the behavior was changed in a subsequent release.

You can now do something similar using SelectMany.

For example: (untested)

dictSubject.SelectMany(n => 
	n.Kind == CollectionNotificationKind.Exists
	? n.ExistingValues.Select(CollectionNotification.CreateOnAdded)
	: Scalar.Return(n))

- Dave