Fork me on GitHub
TypeName SealedAttributeAnalyzer
Check Id CC0023
Category Performance
Severity Warning

Cause

Framework methods that retrieve attributes by default search the whole inheritence hierarchy of the attribute class. Marking the type as sealed eliminate this search and can improve performance.

Example

public class MyAttribute : System.Attribute
{
}

Code fix

A code fix will be presented to you that will transform the code:

public sealed class MyAttribute : System.Attribute
{
}

Code fix

Related rules

None

See also

TBD