views:

30

answers:

1

Using Rx, is there a simple way to create a single Notification<T>?

The closest I've been able to find is:

T value = ..;
var notifyValue = EnumerableEx.Return(value).Materialize().First();

This seems rather roundabout. The constructors for Notification<T> are inaccessible, but is there a factory method that I'm not aware of?

+1  A: 

Notification<T> is an abstract base class. You need to construct one of its subclasses, OnCompleted, OnError, or in this case OnNext.

var notifyValue = new Notification<T>.OnNext(value);
Quartermeister