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

Redundant constructor

CodeRush Classic shows the Redundant constructor code issue if a default constructor is the only constructor declared in a class or struct, provided that its body is empty.

Fix

Remove the redundant constructor.

Purpose

Highlights the redundant constructors, which can be removed to improve code readability.

Example

public class MyClass
{
    public MyClass()
    {

    }
    public string Name { get; set; }
}

Fix:

public class MyClass
{
    public string Name { get; set; }
}