ReSharper 2024.1 Help

Code Inspection: Redundant string.Format() call

Category

Redundancies in Code

ID

RedundantStringFormatCall

EditorConfig

resharper_redundant_string_format_call_highlighting

Default severity

Warning

Language

C#

Requires SWA

No

The String.Format() method is redundant if you use Console.WriteLine(). Console.WriteLine() actually has an overload that calls String.Format() before writing the result to the output stream.

Console.WriteLine(string.Format("This is {0}", z));
Console.WriteLine("This is {0}", z)
Last modified: 15 April 2024