开发者

How does one create a single instance of Notification<T>?

开发者 https://www.devze.com 2023-01-04 16:34 出处:网络
Using Rx, is there a simple way to create a si开发者_C百科ngle Notification<T>? The closest I\'ve been able to find is:

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消