dotnet/roslyn

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

Aperta

#58.557 aperta il 3 gen 2022

 (15 commenti) (0 reazioni) (0 assegnatari)C# (4257 fork)batch import
Area-IDEhelp wanted

Metriche repository

Star
 (20.414 stelle)
Metriche merge PR
 (Merge medio 6g 17h) (256 PR mergiate in 30 g)

Descrizione

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

Guida contributor