dotnet/roslyn
GitHub で見る"Convert to interpolated string" refactoring could simplify constant arguments
Open
#77,023 opened on 2025年2月4日
Area-IDEhelp wanted
Repository metrics
- Stars
- (20,414 stars)
- PR merge metrics
- (平均マージ 6d 17h) (30d で 256 merged PRs)
説明
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=";