-
Today, the following code was discussed on X (Twitter) in Japan. Console.WriteLine(1 + "2"); // 12 This code, familiar to senior C# developers, seems strange to beginners. They say, "It doesn't look like a strongly typed language; it looks like JavaScript." Also, the following code looks confusing even for senior devs. Console.WriteLine(1 + 1 + "1"); // 21
Console.WriteLine("1" + 1 + 1); // 111 Even today, code fixes are available for this code. What I would like to suggest here is to add an analyzer to this, so that the warning level can be changed in .editorconfig. I want to treat this as a warning. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Can you move this to roslyn-analyzers? I can't seem to move it myself. Thanks! |
Beta Was this translation helpful? Give feedback.
Done https://github.com/dotnet/roslyn-analyzers/issues/7057