Skip to content

What's the big deal with IAsyncEnumerable<T> in .NET Core 3.0?

Anthony Chu on July 31, 2019

One of the most exciting features of .NET Core 3.0 and C# 8.0 has been the addition of IAsyncEnumerable&lt;T&gt; (aka async streams). But what's so... [Read Full]
markdown guide

Is there any way that u can show with stopwatch or with memory consumption matching, showing old vs new way is much efficient?


I don't think it will be more efficient in that sense - it blocks less threads so your server can scale better (await more IO bound operations like the DB calls here)

If you use this for algorithms (CPU bound operations) the runtime will probably be worse (there surely is even more overhead than the one produced by async/awaits state machines)


This is cool. Can you write something about SignalR? Thank you.


Sure. Anything in particular that you want to read about?


I would love to read about a current state of SignalR / SSE (Server Sent Events) / gRPC / anything else? - features, gaps, areas to apply/consider using for. What is implemented / supported in .NET Core 3 for "realtime" like apps.


The use of IAsyncEnumerable in a SignalR application. Especially regarding clients communicating to each other. Thank you


Do you know how does it work under the hood? I mean, in your example you pass query like select * from... but, since it's lazy loaded, what's the actual query executed?
How I see it is it retrieves records one by one, which is something similar to looping through IQueryable.
Am I wrong? If so, how does it work exactly?


Nice article, thanks. A thing I wonder when you are using IAsyncEnumerable in controller as you return type of a route. How do you handle the cas where you want to return a NotFoundResult when no items are in the IAsyncEnumerable.


I'm new to this whole progg. stuff but I know there isn't no one out there better than Microsoft. Go .NET !!! hope I get to use this new feature one day

again GO GO .NET


Can you provide an F# example? I've been looking for a way to return an asynSeq.


This article very nice. Useful and easy for understand ! Thank Chu !


Does the new interface support on demand pull?

I.e. what happens if the table contains 100 records but the client uses Take(15)?


I.e. what happens if the table contains 100 records but the client uses Take(15)?

The MoveNextAsync method is called 15 times. Wether or not it does something is an implementation detail.


That's great! It's very helpful. Thanks for sharing.

code of conduct - report abuse