Feature request: Automatically remove empty Else statement after refactoring
I have this code:
lastShareInSection = false;
if (tableStock.Rows[rowCur]["SectorName"].ToString().CompareTo(row["SectorName"].ToString()) != 0)
{
lastShareInSection = true;
}
else
{
lastShareInSection = false;
}
R# correctly states that lastShareInSection in the else statement has the same value as before this assignment. After removing the assignment I get this code:
lastShareInSection = false;
if (tableStock.Rows[rowCur]["SectorName"].ToString().CompareTo(row["SectorName"].ToString()) != 0)
{
lastShareInSection = true;
}
else
{
}
It would be nice if R# would in these situation also automatically remove the Else statement.
Please sign in to leave a comment.