dotnet/roslyn

Use interpolated strings instead of String.Concat or String.Join

Open

#58,557 opened on Jan 3, 2022

View on GitHub
 (15 comments) (0 reactions) (0 assignees)C# (4,257 forks)batch import
Area-IDEhelp wanted

Repository metrics

Stars
 (20,414 stars)
PR merge metrics
 (Avg merge 6d 17h) (256 merged PRs in 30d)

Description

Brief description:

I've gotten some legacy code which is rewritten about 10 years ago where a lot of String.Concat(string[]) or String.Join(string, params string[]) are used. Can you provide a code refactoring to change them to interpolated strings?

Languages applicable:

C# (maybe VB.NET also)

Code example that the analyzer should report:

String.Concat("Hello ", user.Name, "! Time is ", DateTime.Now.ToString());
logger.Log(String.Join(" ", DateTime.Now.ToString(), LogLevel.Info.ToString(), logCategory, logContent));

Contributor guide