CRR0026 - Unused member

This analyzer detects members that were declared but never used.

Tip

You can enable or disable the highlighting of unused members in the code editor using the Highlight unused members checkbox on the Editor | All Languages | Static Code Analysis option page.

class Program {
    static private double a0 = 0.938229;
    static private double a1 = -0.726534;
    static private double a2 = 0.647538;
    static private double a3 = 0.382564; //CRR0026
    public static int Main() {
        string input;
        double x, y;
        while (true) {
            Console.Write("x = ");
            input = Console.ReadLine();
            try {
                x = Convert.ToDouble(input);
                y = a0 + a1 * x + a2 * Math.Pow(x, 2);
                Console.WriteLine($"a0 + a1 * x + a2 * x^2 = {y}");
            }
            catch (FormatException) {
                break;
            }
        }
        return 0;
    }
}

To fix this, remove the corresponding declaration or add it to your program:

class Program {
    static private double a0 = 0.938229;
    static private double a1 = -0.726534;
    static private double a2 = 0.647538;
    static private double a3 = 0.382564;
    public static int Main() {
        string input;
        double x, y;
        while (true) {
            Console.Write("x = ");
            input = Console.ReadLine();
            try {
                x = Convert.ToDouble(input);
                y = a0 + a1 * x + a2 * Math.Pow(x, 2) + a3 * Math.Pow(x, 3);
                Console.WriteLine($"a0 + a1 * x + a2 * x^2  + a3 * x^3 = {y}");
            }
            catch (FormatException) {
                break;
            }
        }
        return 0;
    }
}

Call the Remove Unused Member refactoring to remove an unused member. If you need to do it in several places at once, use the Code Cleanup feature with Remove unused members refactoring enabled.

Note

This analyzer currently works only with private members. This may change in future releases to find unused members in the entire solution.