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

Unused declaration

CodeRush Classic shows the Unused declaration code issue if a private member or a local variable does not have references within its visibility scope.

Fix

Remove the unused declaration.

Purpose

Highlights the declarations, which 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 Data { get; set; }
    private object _Data;
}

Fix:

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