Skip to content

Add string interpolation to Console.WriteLine #380

@giggio

Description

@giggio

We already suggest a code fix for string.Format (on CC0048) to use string interpolation. Let's suggest one for Console.WriteLine.

Should work with:

  • WriteLine(String, Object)
  • WriteLine(String, Object[])
  • WriteLine(String, Object, Object)
  • WriteLine(String, Object, Object, Object)
  • WriteLine(String, Object, Object, Object, Object)

This:

Console.WriteLine("some {0} text", adjective);

Becomes:

Console.WriteLine($"some {adjective} text");

Category: Style
Severity: Info
Diagnostic id: CC0095

More info on Console.WriteLine on MSDN.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions