File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
docs/fundamentals/code-analysis/quality-rules
snippets/csharp/all-rules Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ helpviewer_keywords:
1010- EventsShouldNotHaveBeforeOrAfterPrefix
1111author : gewarren
1212ms.author : gewarren
13+ dev_langs :
14+ - CSharp
1315---
1416# CA1713: Events should not have before or after prefix
1517
@@ -35,6 +37,10 @@ Naming conventions provide a common look for libraries that target the common la
3537
3638Remove the prefix from the event name, and consider changing the name to use the present or past tense of a verb.
3739
40+ ## Example
41+
42+ :::code language="csharp" source="snippets/csharp/all-rules/ca1713.cs" id="snippet1":::
43+
3844## When to suppress warnings
3945
4046Do not suppress a warning from this rule.
Original file line number Diff line number Diff line change 1+ using System ;
2+
3+ namespace ca1713
4+ {
5+ //<snippet1>
6+ public class Session
7+ {
8+ // This code violates the rule.
9+ public event EventHandler ? BeforeClose ;
10+ public event EventHandler ? AfterClose ;
11+
12+ // This code satisfies the rule.
13+ public event EventHandler ? Closing ;
14+ public event EventHandler ? Closed ;
15+ }
16+ //</snippet1>
17+ }
You can’t perform that action at this time.
0 commit comments