Skip to main content

Collection Expression Arguments in C# 15 are "out"

2/12/2026
1 minute read

The first preview of .NET 11 and C# 15 did just release. Some weeks back I did add already an article about that: "Collection Expression Arguments in C# 15+". Well quicker than anticipated that feature is now part of it!

Slightly different syntax#

To my original blog post they changed the syntax.

Here the "pseudo" syntax used in the GitHub issue:

csharp
List<int> allNumbers = [args(capacity: 32), 0, ..evenNumbers, ..oddNumbers];

And here the final version:

csharp
List<int> allNumbers = [with(capacity: 32), 0, ..evenNumbers, ..oddNumbers];

They reused the with operator.

Resources#

An error has occurred. This application may no longer respond until reloaded.Reload x