csharplang
csharplang copied to clipboard
[Proposal]: Target-typed implicit array creation expression `new[]`
Target-typed implicit array creation expression new[]
- Specification: In the discussion for now
- Discussion: https://github.com/dotnet/csharplang/discussions/8992
Summary
Allow KeyValuePair<string, string>[] array = new[] { new("key1", value1), new("key2", value2) };
Design meetings
@jcouv I think we likely don't need to add this. We now hava target typed collection expressions, which work for arrays, and which provide a simpler and cleaner syntax for this: KeyValuePair<string, string>[] array = [new("key1", value1), new("key2", value2)];
Are you ok with me closing this out? Thanks!