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

Redundant base constructor call

CodeRush Classic shows the Redundant base constructor call code issue if a base type constructor call is redundant and can be removed.

Fix

Remove the redundant base type constructor.

Purpose

Highlights the base type constructor calls, which can be removed to improve code readability.

Example

public class MyClassBase
{
    public MyClassBase(){}
}
class MyClass: MyClassBase
{
    public MyClass(string name)
        :base()
    {
        Name = name;
    }
    public string Name { get; private set; }
}

Fix:

public class MyClassBase
{
    public MyClassBase(){}
}
class MyClass: MyClassBase
{
    public MyClass(string name)
    {
        Name = name;
    }
    public string Name { get; private set; }
}