dotnet / dotnet/csharplang

[Proposal]: Collection Expression Arguments (VS 18.8, .NET 11)

Open
#8,887 1 comment 0 reactions 1 assignee Claimed by @CyrusNajmabadi View on GitHub
Implemented Needs ECMA Spec Proposal champion
Dominant language
C#
Stars
12.7k
Forks
1.1k
Avg merge
11h 1m
Merged PRs (30d)
3

Description

# Collection Expression Arguments

* Specification: https://github.com/dotnet/csharplang/blob/main/proposals/csharp-15.0/collection-expression-arguments.md
* Discussion: https://github.com/dotnet/csharplang/discussions/8886

## Summary
[summary]: #summary

Introduce a way for users to create collection expressions (e.g. `[a, b, c]`) while also passing along arguments to the respective creation construction for that collection.

An example strawman syntax for this would be:

```c#
List values = [args(capacity: 32); a, b, c];
```

## Design meetings

* https://github.com/dotnet/csharplang/blob/main/meetings/2024/LDM-2024-12-09.md#collection-expression-arguments
* https://github.com/dotnet/csharplang/blob/main/meetings/2025/LDM-2025-01-22.md#collection-expression-arguments
* https://github.com/dotnet/csharplang/blob/main/meetings/2025/LDM-2025-03-12.md#collection-builder-method-parameter-order
* https://github.com/dotnet/csharplang/blob/main/meetings/2025/LDM-2025-03-17.md#collection-expression-arguments
* https://github.com/dotnet/csharplang/blob/main/meetings/2025/LDM-2025-04-09.md#dictionary-expressions
* https://github.com/dotnet/csharplang/blob/main/meetings/2025/LDM-2025-04-09.md#collection-expression-arguments
* https://github.com/dotnet/csharplang/blob/main/meetings/2025/LDM-2025-04-14.md
* https://github.com/dotnet/csharplang/blob/main/meetings/2025/LDM-2025-05-07.md#collection-expression-arguments
* https://github.com/dotnet/csharplang/blob/main/meetings/2025/LDM-2025-05-12.md#collection-expression-arguments
* https://github.com/dotnet/csharplang/blob/main/meetings/2025/LDM-2025-12-10.md#collection-expression-arguments
* https://github.com/dotnet/csharplang/blob/main/meetings/2025/LDM-2025-12-17.md#collection-expression-arguments-parsing-question

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.