dotnet/roslyn
在 GitHub 查看"Convert to interpolated string" refactoring could simplify constant arguments
Open
#77,023 创建于 2025年2月4日
Area-IDEhelp wanted
仓库指标
- Star
- (20,414 star)
- PR 合并指标
- (平均合并 6天 17小时) (30 天内合并 256 个 PR)
描述
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=";