Skip to main content

Static class cannot be sealed

In This Article

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

#Fix

Remove the sealed or static modifier from the class declaration.

#Purpose

Highlights the class declarations, which would cause the A class cannot be both static and sealed compilation error.

#Example

public static sealed class MyClass

Fixes:

public static class MyClass
public sealed class MyClass