Custom async IAsyncEnumerable type? #4798
-
C# 7.2 introduced builders for custom task-like types, then C# 8 introduced async enumerators. I'm wondering if it's possible to back an If I create a type that implements public struct MyAsyncEnumerable<T> : IAsyncEnumerable<T>
{
...
} public async MyAsyncEnumerable<int> EnumerateMyValuesAsync()
{
await Task.Yield();
yield return 42;
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
@stephentoub I saw you wrote the Microsoft article about async enumerables in November 2019, do you have the answer to this? |
Beta Was this translation helpful? Give feedback.
-
It's not.
No. There's no ability in the language/compiler to substitute an implementation for any iterator, whether sync or async. |
Beta Was this translation helpful? Give feedback.
It's not.
No. There's no ability in the language/compiler to substitute an implementation for any iterator, whether sync or async.