Using Rx, is there a simple way to create a si开发者_C百科ngle 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?
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);
精彩评论