The requested page is not available for the requested platform. You are viewing the content for Default platform.

Redundant ToString call

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