我有一个可观察的IObservable<T>/ISubject<T>并希望通过使用 SignalR 来返回它。SignalR 具有异步流的概念,您必须在其中返回一个IAsyncEnumerable<T>.
如何将 an 转换IObservable<T>为 an IAsyncEnumerable<T>?
我有一个可观察的IObservable<T>/ISubject<T>并希望通过使用 SignalR 来返回它。SignalR 具有异步流的概念,您必须在其中返回一个IAsyncEnumerable<T>.
如何将 an 转换IObservable<T>为 an IAsyncEnumerable<T>?
程序集中有一个ToAsyncEnumerable扩展方法,可在此处System.Linq.Async作为 NuGet 包使用。
public static IAsyncEnumerable<TSource> ToAsyncEnumerable<TSource>(
this IObservable<TSource> source);