dotnet / docs

This repository contains .NET Documentation.
https://learn.microsoft.com/dotnet
Creative Commons Attribution 4.0 International
4.22k stars 5.87k forks source link

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

Open triangletrianglesquareplusx opened 6 months ago

triangletrianglesquareplusx commented 6 months ago

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

gewarren commented 5 months ago

@triangletrianglesquareplusx I'm not seeing the suggestion IDE0300 on the code you provided. Can you clarify or check if you still see the suggestion?