Skip to main content

Redundant ToString call

In This Article

CodeRush Classic shows the Redundant ToString call code issue if a ToString() call is redundant and can be removed.

#Fix

Remove the redundant ToString() call.

#Purpose

Highlights the ToString() calls, which can be removed to improve code readability.

#Example

Console.WriteLine(string.Format("{0} is {1} years old.", name, age.ToString()));

Fix:

Console.WriteLine(string.Format("{0} is {1} years old.", name, age));