Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to make IDE0028 not apply if type isn't visible elsewhere on the line #7515

Open
ThioJoe opened this issue Dec 22, 2024 · 0 comments
Open

Comments

@ThioJoe
Copy link

ThioJoe commented Dec 22, 2024

Analyzer

Diagnostic ID: IDE0028

Describe the improvement

I'd like an option to not show the IDE0028 suggestion for existing variables, because it would typically result in the type not showing on the line at all, and I personally would rather the type be clearly apparent in such cases.

For Example:

On a line like this:

_someProperty = new List<string>();

Where it suggests simplifying to this:

_someProperty = [];

However if the variable or property was declared far away in the code, I find it more clear to leave it with the explicit type showing.

As opposed to a line like this where the type is still visible on the left so I do indeed want to simplify it on the right.

List<string> someOtherVariable = [];

In other words I like the type to always be showing at least once on the line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant