dotnet / dotnet/docs

Additional information in IDE0300 on array initialization where all values are not previously known

Open
#39,894 1 comment 0 reactions 0 assignees View on GitHub
:watch: Not Triaged dotnet-fundamentals/svc
Dominant language
No language data
Stars
4.8k
Forks
6.1k
Avg merge
19h 10m
Merged PRs (30d)
268

Description

### Type of issue

Missing information

### Description

Could an example be provided for cases where we have initialized our array but we still do not know all the values.
Example:
`string[] fraudulentOrderIds = new string[3];` currently still gives the 'Collection initialization can be simplified' warning/flag.
Any advice on this would be welcome. Appreciate your work.

### Page URL

https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0300

### Content source URL

https://github.com/dotnet/docs/blob/main/docs/fundamentals/code-analysis/style-rules/ide0300.md

### Document Version Independent Id

06844c7c-ca82-876d-36ba-c69b21b8fe06

### Article author

@gewarren

### Metadata

* ID: 49149098-919a-420e-7c0d-6e066399080f
* Service: **dotnet-fundamentals**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.