Skip to content

[C# 15-Fundamentals and reference]: New Feature - Collection expression arguments #51440

@BillWagner

Description

@BillWagner

.NET 11 Preview

.NET 11 Preview 1

Link to speclet

Link to Pull request

New behavior

Test plan: dotnet/roslyn#80613

Collection expressions can now include with elements to specify arguments to the constructor of the collection being created.

In general, this will be used to specify comparers for Dictionary types, capacity for lists, and similar kinds of arguments.

For this feature update all articles that cover collection expressions to include an example or two that include with elements.

Note that dictionary expressions aren't available in a preview yet.

Language reference tasks

No response

Everyday C# tasks

No response


Associated WorkItem - 550638

Metadata

Metadata

Assignees

Type

No type

Projects

Status

🏗 In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions