Skip to main content

Sealed class cannot be abstract

In This Article

CodeRush Classic shows the Sealed class cannot be abstract code issue if a sealed class is marked as abstract.

#Fix

Remove the abstract or sealed modifier from the class declaration.

#Purpose

Highlights the class declarations, which would cause the “An abstract class cannot be sealed or static” compilation error.

#Example

public sealed abstract class MyClass

Fixes:

public sealed class MyClass
public abstract class MyClass