-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Add preview documentation for collection expression parameters #51454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add preview documentation for collection expression parameters #51454
Conversation
Build the initial framework for What's new in C# 15.
Edit and update text for style.
|
@adegeo I marked this ready for review even though the new examples don't build. They should once .NET 11 preview 1 is out. I'll fix the samples and then (hopefully) merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds preview documentation for C# 15's collection expression arguments feature, which allows passing constructor or factory method arguments to collections using a with(...) element in collection expressions. The documentation is being prepared for .NET 11 and Visual Studio 2026.
Changes:
- New documentation file for C# 15 with collection expression arguments feature
- Updated collection expressions reference documentation with detailed sections on constructor arguments, collection builder arguments, and interface target types
- Updated object and collection initializers programming guide with new collection expression arguments section
- Configuration updates to TOC files, language version tables, and build configuration
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/csharp/whats-new/csharp-15.md | New file introducing C# 15 with collection expression arguments feature |
| docs/csharp/language-reference/operators/collection-expressions.md | Added comprehensive documentation for collection expression arguments including usage examples and restrictions |
| docs/csharp/programming-guide/classes-and-structs/object-and-collection-initializers.md | Updated guide with collection expression arguments section and style improvements throughout |
| docs/csharp/language-reference/operators/snippets/shared/CollectionExpressionExamples.cs | Added code examples demonstrating collection expression arguments with custom types |
| docs/csharp/programming-guide/classes-and-structs/snippets/object-collection-initializers/CollectionExpressionArguments.cs | New code snippet file with collection expression arguments examples |
| docs/csharp/language-reference/operators/snippets/shared/operators.csproj | Updated target framework to net11.0 and added preview language version |
| docs/csharp/programming-guide/classes-and-structs/snippets/object-collection-initializers/object-collection-initializers.csproj | Updated target framework to net11.0 and added preview language version |
| docs/csharp/toc.yml | Added C# 15 entry and breaking changes link for .NET 11 |
| docs/csharp/specification/toc.yml | Added link to collection expression arguments specification |
| docs/csharp/language-reference/language-versioning.md | Updated to reference C# 15 and .NET 11 support |
| docs/csharp/language-reference/includes/langversion-table.md | Added C# 15.0 language version entry |
| docs/csharp/language-reference/includes/default-langversion-table.md | Added .NET 11 mapping to C# 15 |
| docfx.json | Added configuration for breaking changes file and collection expression arguments proposal |
| .openpublishing.redirection.csharp.json | Updated redirects to point to C# 15 as latest version |
docs/csharp/programming-guide/classes-and-structs/object-and-collection-initializers.md
Outdated
Show resolved
Hide resolved
...classes-and-structs/snippets/object-collection-initializers/CollectionExpressionArguments.cs
Outdated
Show resolved
Hide resolved
docs/csharp/language-reference/operators/snippets/shared/CollectionExpressionExamples.cs
Show resolved
Hide resolved
docs/csharp/programming-guide/classes-and-structs/object-and-collection-initializers.md
Outdated
Show resolved
Hide resolved
docs/csharp/programming-guide/classes-and-structs/object-and-collection-initializers.md
Outdated
Show resolved
Hide resolved
docs/csharp/programming-guide/classes-and-structs/object-and-collection-initializers.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Update pertinent articles for C# 15's collection expression parameters.
Fixes #51440
Internal previews