-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Description
Currenty C# supports pull based sequence generators.
As IObservable<T> and IObserver<T> are now in mscorlib and Rx is such a success not only in .NET but in other languages and runtimes why not to add to C# ability to easily create async push based stream generators.
It could look like this:
private async IObservable<string> GetData()
{
var data = await MakeRequest();
yield return data;
yield return await MakeAnotherRequest();
}It would complete language support in the matrix of generators:
| sync | async | |
|---|---|---|
| single | T | Task<T> |
| multiple | IEnumerable<T> | IObservable<T> |
Reactions are currently unavailable