Static class cannot contain protected member
CodeRush Classic shows the Static class cannot contain protected member code issue if a protected member is declared in a static class.
#Fix
Use any access modifier, except protected and protected internal in the static class.
#Purpose
Highlights the static class member declarations, which would cause the Static class cannot contain protected members compilation error.
#Example
public static class MyClass
{
protected static float │GetSquare(float a, float b)
{
return a * b;
}
}
Fix:
public static class MyClass
{
private static float GetSquare(float a, float b)
{
return a * b;
}
}