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

Redundant else statement

CodeRush Classic shows the Redundant else statement code issue if an else block is empty.

Fix

Remove the empty else block.

Purpose

Highlights the empty else, which can be removed to improve code readability.

Example

public string Text 
{
    get { return _Text; }
    set
    {
        if (!String.IsNullOrEmpty(_Text))
        {
            ProcessText(value); 
            _Text = value;
        }else
        {

        }
    }
}

Fix:

public string Text 
{
    get { return _Text; }
    set
    {
        if (!String.IsNullOrEmpty(_Text))
        {
            ProcessText(value); 
            _Text = value;
        }
    }
}