Skip to content

Remove Unnecessary ToString in String Concatenation #753

@wmjordan

Description

@wmjordan

The runtime automatically calls ToString for string concatenation operations.

For instance, the ToString is unnecessary in the following code:

 var foo = "a" + new object().ToString();

It should become:

 var foo = "a" + new object();

Should also mark the .ToString() invocation with WellKnownDiagnosticTags.Unnecessary.

Category: Style
Diagnostic Id: CC0118
Severity: Info

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions