blog post image
Andrew Lock avatar

Andrew Lock

Series: Behind the scenes of collection expressions

Share on:

C#12 and .NET 8 introduced the collection expressions feature as a unified way of creating collections. Collection expressions are somewhat analogous to the collection initializers you have likely used to create arrays, but they provide a number of benefits in the generated code.

In this series I look at how you can use collection expressions in your own code. I then show the code that is generated, and how this can lead to improved performance. Finally I show how you can use them with your own types.

If you're only interested in using collection expressions, then the first post covers everything you need to know. The later posts look behind the scenes to understand why collection expressions are neat and how they can improve performance.

  • Buy Me A Coffee
  • Donate with PayPal
Andrew Lock | .Net Escapades
Want an email when
there's new posts?