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

Redundant String.Format call

CodeRush Classic shows the Redundant String.Format call code issue if a String.Format() call has only one argument.

Fix

Remove the redundant String.Fromat() call.

Purpose

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

Example

public class MyClass
{
    public MyClass(string text)
    {
        _Text = text;
    }
    private string _Text;
    public string GetTextData()
    {
        return string.Format(_Text);
    }
}

Fix:

public class MyClass
{
    public MyClass(string text)
    {
        _Text = text;
    }
    private string _Text;
    public string GetTextData()
    {
        return _Text;
    }
}