Skip to content

[Proposal]: Collection Expressions Next (C#13 and beyond) #7913

@CyrusNajmabadi

Description

@CyrusNajmabadi

Collection Expressions Next

  • Proposed
  • Prototype: Not Started
  • Implementation: Not Started
  • Specification: Not Started

Summary

This issue is intended to be the umbrella tracking item for all collection expression designs and work following the core design (#5354) that shipped in C#12.

As this is likely to be a large item with many constituent parts, it will link out to respective discussions and designs as they occur.

Roughly, here are the items we would like to consider, as well as early notes on the topic: https://github.com/dotnet/csharplang/blob/main/meetings/working-groups/collection-literals/CL-2024-01-23.md

  1. Dictionary expressions. [Proposal]: Dictionary expressions #7822
  2. Natural type
  3. Immediately enumerated collections. e.g. ["a", .. b ? ["c"] : []] and foreach (bool? b in [true, false, null]). Collection expressions: inline collections in spreads and foreach #7864
  4. Extension methods on collections
  5. Missing collection-creatable types (e.g. Memory<T>, ArraySegment<T> etc.)
  6. Supporting non-generic core collections (IEnumerable, etc.)
  7. Relaxing restrictions. Open issue: relax requirement that type be enumerable to participate in collection expressions #7744

Design meetings

https://github.com/dotnet/csharplang/blob/main/meetings/2024/LDM-2024-01-08.md - Iteration types of collections
https://github.com/dotnet/csharplang/blob/main/meetings/working-groups/collection-literals/CL-2024-01-23.md - WG meetup
https://github.com/dotnet/csharplang/blob/main/meetings/2024/LDM-2024-01-10.md - Conversions vs construction
https://github.com/dotnet/csharplang/blob/main/meetings/2024/LDM-2024-02-05.md#collection-expressions-inline-collections
https://github.com/dotnet/csharplang/blob/main/meetings/2024/LDM-2024-09-06.md#collection-expressions-next-c13-and-beyond

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions