dotnet / dotnet/csharplang

[Proposal]: Immediately Enumerated Collection Expressions

Open
#9,754 0 comments 0 reactions 1 assignee Claimed by @RikkiGibson View on GitHub
Proposal champion
Dominant language
C#
Stars
12.7k
Forks
1.1k
Avg merge
11h 1m
Merged PRs (30d)
3

Description

* Specification: https://github.com/dotnet/csharplang/blob/main/proposals/immediately-enumerated-collection-expressions.md
* Discussion: #9755

## Summary
[summary]: #summary

Permit collection expressions in "immediately enumerated" contexts, without requiring a target type.

```cs
foreach (bool b in [true, false])
{
doMyLogicWith(b);
}

string[] items1 = ["a", "b", .. ["c"]];
string[] items2 = ["a", "b", .. includeRest ? ["c", "d"] : []];
```

See also #9739.

## Design meetings

* https://github.com/dotnet/csharplang/blob/main/meetings/2025/LDM-2025-10-13.md#immediately-enumerated-collection-expressions
* https://github.com/dotnet/csharplang/blob/main/meetings/2026/LDM-2026-01-12.md#immediately-enumerated-collection-expressions

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.