File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed
docs/fundamentals/code-analysis/quality-rules
snippets/csharp/all-rules Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ helpviewer_keywords:
1010- IdentifiersShouldNotContainUnderscores
1111author : gewarren
1212ms.author : gewarren
13+ dev_langs :
14+ - CSharp
1315---
1416# CA1707: Identifiers should not contain underscores
1517
@@ -35,6 +37,10 @@ Naming conventions provide a common look for libraries that target the common la
3537
3638Remove all underscore characters from the name.
3739
40+ ## Example
41+
42+ :::code language="csharp" source="snippets/csharp/all-rules/ca1707.cs" id="snippet1":::
43+
3844## When to suppress warnings
3945
4046Do not suppress warnings for production code. However, it's safe to suppress this warning for test code.
Original file line number Diff line number Diff line change 1+ using System ;
2+
3+ // <Snippet1>
4+ // This code violates the rule.
5+ namespace ca_1707
6+ {
7+ public interface IUser_Service
8+ {
9+ void Add_User ( User_Model user_Model ) ;
10+ }
11+
12+ public class User_Service : IUser_Service
13+ {
14+ public const string Admin_Name = "admin" ;
15+ public event EventHandler ? User_Added ;
16+
17+ public void Add_User ( User_Model user_Model )
18+ {
19+ // ...
20+ }
21+ }
22+
23+ public struct User_Model
24+ {
25+ public int User_Id { get ; set ; }
26+ }
27+
28+ public enum User_Type
29+ {
30+ Client_User = 0 ,
31+ Manager_Admin = 1 ,
32+ Syper_Admin = 3 ,
33+ }
34+ }
35+ // </Snippet1>
You can’t perform that action at this time.
0 commit comments