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

Remove Redundant Destructor (C#)

Removes the destructor under the cursor, if it does not contain executable code.

Availability

Available from the context menu or via shortcuts:

  • when the cursor is on a destructor declaration, provided that the destructor does not contain executable code lines.

Examples

class TestClass
{
    private string _name;
    public TestClass(string param)
    {
        _name = param;
    }~ TestClass()
    {

    }
}

Result:

class TestClass
{
    private string _name;
    public TestClass(string param)
    {
        _name = param;
    }
}

Screenshot

rsRemoveRedundantDestructor