dotnet/roslyn

"Convert to interpolated string" refactoring could simplify constant arguments

Open

#77.023 aberto em 4 de fev. de 2025

Ver no GitHub
 (0 comments) (0 reactions) (0 assignees)C# (4.257 forks)batch import
Area-IDEhelp wanted

Métricas do repositório

Stars
 (20.414 stars)
Métricas de merge de PR
 (Mesclagem média 6d 17h) (256 fundiu PRs em 30d)

Description

Repro:

string s = string.Format("{0}={1}", "Key", null);

Run "Convert to interpolated string" on this. It produces:

string s = $"{"Key"}={null}";

but it could have produced:

string s = $"Key=";

or since there are no other holes in this particular case:

string s = "Key=";

Guia do colaborador