Skip to content

Commit 3d28536

Browse files
authored
Add code example for CA1716 rule (#48956) (#48957)
* Add code example for CA1716 rule (#48956) * Delete VB from languages (#48956)
1 parent 5989952 commit 3d28536

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

docs/fundamentals/code-analysis/quality-rules/ca1716.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ helpviewer_keywords:
1010
- CA1716
1111
author: gewarren
1212
ms.author: gewarren
13+
dev_langs:
14+
- CSharp
1315
---
1416
# CA1716: Identifiers should not match keywords
1517

@@ -43,6 +45,10 @@ Case-insensitive comparison is used for Visual Basic keywords, and case-sensitiv
4345

4446
Select a name that does not appear in the list of keywords.
4547

48+
## Example
49+
50+
:::code language="csharp" source="snippets/csharp/all-rules/ca1716.cs" id="snippet1":::
51+
4652
## When to suppress warnings
4753

4854
You can suppress a warning from this rule if you're sure that the identifier won't confuse users of the API, and that the library is usable in all available languages in .NET.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace ca1716
2+
{
3+
//<snippet1>
4+
// This code violates the rule.
5+
public class Class { }
6+
public class Event { }
7+
public class String { }
8+
public class Namespace { }
9+
public class Object { }
10+
public class Public { }
11+
public class Static { }
12+
//</snippet1>
13+
}

0 commit comments

Comments
 (0)