Skip to content

Collection expressions turn out to be evil in some scenarios. #111342

Answered by huoyaoyuan
ScarletKuro asked this question in General
Discussion options

You must be logged in to vote

The analyzer rule IDE0300 is configurable in two modes: when_types_exactly_match and when_types_loosely_match. See the documentation at https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0300 .

when_types_exactly_match has the behavior you want. It won't suggest changes to the actual type created. when_types_loosely_match is set as the default because it's usually beneficial in more cases, but you can turn it off.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ScarletKuro
Comment options

Answer selected by ScarletKuro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants