Skip to main content

Constant cannot be marked static

In This Article

CodeRush Classic shows the Constant cannot be marked static code issue if a constant is marked static.

#Fix

Remove the static keyword from the constant declaration.

#Purpose

Highlights the constant declaration statements, which would cause the The constant cannot be marked static compilation error.

#Example

private static const double Pi = 3.14;

Fix:

private const double Pi = 3.14;