Home > Coding Helpers > Code Providers – Seal Class

Code Providers – Seal Class

January 16th, 2011

This is one of the simplest code provider operations which simply marks the active class as ‘sealed’ (CSharp) or ‘NotInheritable‘ (Visual Basic). The sealed modifier is used to prevent inheriting from a class. For example, this can be useful when creating ‘helper’ classes containing utility methods that should never be extended by overriding the existing functionality. Another benefit of this code provider is that it enables a hypothetical run-time optimization, because having a sealed class known to never have any derivations; it is possible for the compiler to transform virtual function member invocations into non-virtual which take less time to perform.

CSharp preview:

CodeRush Seal Class code provider preview in CSharp

Visual Basic preview:

CodeRush Seal Class code provider preview in Visual Basic

Products: CodeRush Pro
Versions: 10.2 and up
VS IDEs: any
Updated: Jan/26/2011
ID: C046

Similar Posts:

  1. Scott Slack
    May 21st, 2013 at 16:04 | #1

    I optimize a class that has only static methods to be a static class.