Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/fundamentals/code-analysis/quality-rules/ca1713.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ helpviewer_keywords:
- EventsShouldNotHaveBeforeOrAfterPrefix
author: gewarren
ms.author: gewarren
dev_langs:
- CSharp
---
# CA1713: Events should not have before or after prefix

Expand All @@ -35,6 +37,10 @@ Naming conventions provide a common look for libraries that target the common la

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

## Example

:::code language="csharp" source="snippets/csharp/all-rules/ca1713.cs" id="snippet1":::

## When to suppress warnings

Do not suppress a warning from this rule.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;

namespace ca1713
{
//<snippet1>
public class Session
{
// This code violates the rule.
public event EventHandler? BeforeClose;
public event EventHandler? AfterClose;

// This code satisfies the rule.
public event EventHandler? Closing;
public event EventHandler? Closed;
}
//</snippet1>
}
Loading