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

SA1000 Target-typed New expressions in C#9 #3295

Closed
robertlarkins opened this issue Jan 22, 2021 · 2 comments
Closed

SA1000 Target-typed New expressions in C#9 #3295

robertlarkins opened this issue Jan 22, 2021 · 2 comments

Comments

@robertlarkins
Copy link

Rule SA1000 provides an error for target-typed new expressions.

For example if I have a field:

private readonly List<Student> students = new();

Rule SA1000 errors on the new. Doing the following fixes it, but I don't think that is the best solution.

private readonly List<Student> students = new ();

Is it possible to get SA1000 to accomodate target-typed new expressions? Similar to how it allows an expression like this:

var myStrings = new[] { "a", "b", "c" };
@robertlarkins
Copy link
Author

I see it has been fixed now.

@sharwell
Copy link
Member

Duplicate of #3214

@sharwell sharwell marked this as a duplicate of #3214 Jan 25, 2021
@sharwell sharwell closed this as not planned Won't fix, can't repro, duplicate, stale Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants