dotnet/roslyn

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

Ouverte

#58 557 ouverte le 3 janv. 2022

 (15 commentaires) (0 réaction) (0 personne assignée)C# (4 257 forks)batch import
Area-IDEhelp wanted

Métriques du dépôt

Stars
 (20 414 étoiles)
Métriques de merge PR
 (Merge moyen 6j 17h) (256 PRs mergées en 30 j)

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));

Guide contributeur