[Proposal]: Immediately Enumerated Collection Expressions
- 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.