CRR0026 - Unused member

  • 2 minutes to read

This analyzer detects members that are not used in code. Specify accessibility levels for these members in the CodeRush options dialog:

  • Open the Editor | C# (Visual Basic) | Code Analysis | Unused Code Analysis options page.
  • Specify accessibility levels for unused members. For example, set the public option and uncheck other options to allow CodeRush to detect unused public members only.


The following example demonstrates how the analyzer detects an unused public member:



Use the Highlight unused code in editor check box in the Editor | C# (Visual Basic) | Code Analysis | General option page to enable or disable the highlighting of unused members in the code editor.

To fix this issue, perform one of the following actions:

  • Remove the public member 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);
                Console.WriteLine($"a0 + a1 * x + a2 * x^2  + a3 * x^3 = {y}");
            catch (FormatException) {
        return 0;

You can use the Remove unused members cleanup rule to remove unused private members. To do this:

  • Specify options as shown in the screenshot below. This allows CodeRush to apply this cleanup rule when you save a document and when you run code cleanup.


  • Run Code Cleanup.