Skip to content

Latest commit

 

History

History
40 lines (30 loc) · 1.98 KB

File metadata and controls

40 lines (30 loc) · 1.98 KB
title description ms.date f1_keywords helpviewer_keywords author ms.author
CA1713: Events should not have before or after prefix (code analysis)
Learn about code analysis rule CA1713: Events should not have before or after prefix
11/04/2016
EventsShouldNotHaveBeforeOrAfterPrefix
CA1713
CA1713
EventsShouldNotHaveBeforeOrAfterPrefix
gewarren
gewarren

CA1713: Events should not have before or after prefix

Property Value
Rule ID CA1713
Title Events should not have before or after prefix
Category Naming
Fix is breaking or non-breaking Breaking
Enabled by default in .NET 8 No

Cause

The name of an event starts with 'Before' or 'After'.

Rule description

Event names should describe the action that raises the event. To name related events that are raised in a specific sequence, use the present or past tense to indicate the relative position in the sequence of actions. For example, when naming a pair of events that is raised when closing a resource, you might name it 'Closing' and 'Closed', instead of 'BeforeClose' and 'AfterClose'.

Naming conventions provide a common look for libraries that target the common language runtime. This reduces the learning curve that is required for new software libraries, and increases customer confidence that the library was developed by someone who has expertise in developing managed code.

How to fix violations

Remove the prefix from the event name, and consider changing the name to use the present or past tense of a verb.

When to suppress warnings

Do not suppress a warning from this rule.