Virtual member cannot be declared in sealed class

CodeRush shows the Virtual member cannot be declared in sealed class code issue if a sealed class contains a virtual member declaration.

Fix

Make the member non-virtual.

Purpose

Highlights the virtual member declarations, which would cause the 'Member name' is a new virtual member in a sealed class compilation error.

Example

public sealed class MyClass
{
    public virtual void ProcessData(object data)
    {
        if (Data != null)
            Data = data;
    }
    public object Data { get; private set; }
}

Fix:

public sealed class MyClass
{
    public void ProcessData(object data)
    {
        if (Data != null)
            Data = data;
    }
    public object Data { get; private set; }
}