dotnet/roslyn
View on GitHub"Convert to interpolated string" refactoring could simplify constant arguments
Open
#77,023 opened on Feb 4, 2025
Area-IDEhelp wanted
Repository metrics
- Stars
- (20,414 stars)
- PR merge metrics
- (Avg merge 6d 17h) (256 merged PRs in 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=";