roslyn: "When variable type is apparent" doesn't apply to array initialization
This the same bug I filed https://github.com/dotnet/roslyn/issues/23907, but it stated that it was fixed.
Version Used: Version 15.8.0 Preview 1.0 [27628.0.d15.8]
Steps to Reproduce:

public class Foo
{
public void Method()
{
var files = new string[0];
}
}
Expected Behavior:
No message
Actual Behavior:
Message IDE0008 Use explicit type instead of ‘var’ ConsoleApp300 C:\Users\davkean\Source\Repos\ConsoleApp300\ConsoleApp300\Program.cs 6 Active
About this issue
- Original URL
- State: open
- Created 9 years ago
- Comments: 18 (17 by maintainers)
I reviewed https://github.com/dotnet/roslyn/issues/26531#issuecomment-385825621 and https://github.com/dotnet/roslyn/issues/26531#issuecomment-385985344 again today with @mavasani. I believe my original concerns can now be addressed by setting the severity for the diagnostic ID instead of setting it as part of the code style configuration. For example, the “allow when apparent, disallow otherwise” setting could be:
@Neme12 That makes sense, I was grouping the following together when I filed https://github.com/dotnet/roslyn/issues/23714, but I like your idea better.
@sharwell
I don’t think so. I would expect
0to be classified as “not apparent”.varwould only be suggested if you typevar i = new int()The current set of options is:
I believe having these options instead would make sense and only increase the number o possible combinations from 8 to 9 while solving this issue: