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

Redundant destructor

CodeRush Classic shows the Redundant destructor code issue if a destructor is empty.

Fix

Remove the empty destructor.

Purpose

Highlights the destructors that can be removed to improve code readability.

Example

public class MyClass
{
    public MyClass(string name)
    {
        Name = name;
    }
    public string Name { get; private set; }
    public object Value { get; set; }~MyClass()
    {

    }
}

Fix:

public class MyClass
{
    public MyClass(string name)
    {
        Name = name;
    }
    public string Name { get; private set; }
    public object Value { get; set; }
}