@@ -29,9 +29,13 @@ csharp_new_line_between_query_expression_clauses = true
29
29
csharp_indent_block_contents = true
30
30
csharp_indent_braces = false
31
31
csharp_indent_case_contents = true
32
+ csharp_indent_case_contents_when_block = true
32
33
csharp_indent_switch_labels = true
33
34
csharp_indent_labels = one_less_than_current
34
35
36
+ # Modifier preferences
37
+ csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
38
+
35
39
# avoid this. unless absolutely necessary
36
40
dotnet_style_qualification_for_field = false :suggestion
37
41
dotnet_style_qualification_for_property = false :suggestion
@@ -40,59 +44,80 @@ dotnet_style_qualification_for_event = false:suggestion
40
44
41
45
# only use var when it's obvious what the variable type is
42
46
csharp_style_var_for_built_in_types = false :none
43
- csharp_style_var_when_type_is_apparent = false :suggestion
44
- csharp_style_var_elsewhere = false :suggestion
47
+ csharp_style_var_when_type_is_apparent = true :suggestion
48
+ csharp_style_var_elsewhere = true :suggestion
45
49
46
- # use language keywords instead of BCL types
50
+ # Types: use keywords instead of BCL types, and permit var only when the type is clear
51
+ csharp_style_var_for_built_in_types = false :suggestion
52
+ csharp_style_var_when_type_is_apparent = false :none
53
+ csharp_style_var_elsewhere = false :suggestion
47
54
dotnet_style_predefined_type_for_locals_parameters_members = true :suggestion
48
55
dotnet_style_predefined_type_for_member_access = true :suggestion
49
56
50
57
# name all constant fields using PascalCase
51
58
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
52
59
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
53
60
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
54
-
55
61
dotnet_naming_symbols.constant_fields.applicable_kinds = field
56
62
dotnet_naming_symbols.constant_fields.required_modifiers = const
57
-
58
63
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
59
64
60
65
# static fields should have s_ prefix
66
+ dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
67
+ dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
68
+ dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
61
69
dotnet_naming_symbols.static_fields.applicable_kinds = field
62
70
dotnet_naming_symbols.static_fields.required_modifiers = static
63
-
64
- dotnet_naming_style.static_prefix_style.capitalization = camel_case
71
+ dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected
72
+ dotnet_naming_style.static_prefix_style.required_prefix = s_
73
+ dotnet_naming_style.static_prefix_style.capitalization = camel_case
65
74
66
75
# internal and private fields should be _camelCase
67
76
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
68
77
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
69
78
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
70
-
71
79
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
72
80
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
73
-
74
81
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
75
- dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
82
+ dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
76
83
77
84
# Code style defaults
85
+ csharp_using_directive_placement = outside_namespace:suggestion
78
86
dotnet_sort_system_directives_first = true
79
- csharp_preserve_single_line_blocks = true
80
- csharp_preserve_single_line_statements = false
87
+ csharp_prefer_braces = true :silent
88
+ csharp_preserve_single_line_blocks = true :none
89
+ csharp_preserve_single_line_statements = false :none
90
+ csharp_prefer_static_local_function = true :suggestion
91
+ csharp_prefer_simple_using_statement = false :none
92
+ csharp_style_prefer_switch_expression = true :suggestion
93
+
94
+ # Code quality
95
+ dotnet_style_readonly_field = true :suggestion
96
+ dotnet_code_quality_unused_parameters = non_public:suggestion
81
97
82
98
# Expression-level preferences
83
99
dotnet_style_object_initializer = true :suggestion
84
100
dotnet_style_collection_initializer = true :suggestion
85
101
dotnet_style_explicit_tuple_names = true :suggestion
86
102
dotnet_style_coalesce_expression = true :suggestion
87
103
dotnet_style_null_propagation = true :suggestion
104
+ dotnet_style_prefer_is_null_check_over_reference_equality_method = true :suggestion
105
+ dotnet_style_prefer_inferred_tuple_names = true :suggestion
106
+ dotnet_style_prefer_inferred_anonymous_type_member_names = true :suggestion
107
+ dotnet_style_prefer_auto_properties = true :suggestion
108
+ dotnet_style_prefer_conditional_expression_over_assignment = true :silent
109
+ dotnet_style_prefer_conditional_expression_over_return = true :silent
110
+ csharp_prefer_simple_default_expression = true :suggestion
88
111
89
112
# Expression-bodied members
90
- csharp_style_expression_bodied_methods = false : none
91
- csharp_style_expression_bodied_constructors = false : none
92
- csharp_style_expression_bodied_operators = false : none
113
+ csharp_style_expression_bodied_methods = true : suggestion
114
+ csharp_style_expression_bodied_constructors = true : suggestion
115
+ csharp_style_expression_bodied_operators = true : suggestion
93
116
csharp_style_expression_bodied_properties = true :suggestion
94
- csharp_style_expression_bodied_indexers = true :none
95
- csharp_style_expression_bodied_accessors = true :none
117
+ csharp_style_expression_bodied_indexers = true :suggestion
118
+ csharp_style_expression_bodied_accessors = true :suggestion
119
+ csharp_style_expression_bodied_lambdas = true :suggestion
120
+ csharp_style_expression_bodied_local_functions = true :suggestion
96
121
97
122
# Pattern matching
98
123
csharp_style_pattern_matching_over_is_with_cast_check = true :suggestion
@@ -103,6 +128,11 @@ csharp_style_inlined_variable_declaration = true:suggestion
103
128
csharp_style_throw_expression = true :suggestion
104
129
csharp_style_conditional_delegate_call = true :suggestion
105
130
131
+ # Other features
132
+ csharp_style_prefer_index_operator = false :none
133
+ csharp_style_prefer_range_operator = false :none
134
+ csharp_style_pattern_local_over_anonymous_function = false :none
135
+
106
136
# Space preferences
107
137
csharp_space_after_cast = false
108
138
csharp_space_after_colon_in_inheritance_clause = true
@@ -152,4 +182,4 @@ indent_size = 2
152
182
[* .sh ]
153
183
end_of_line = lf
154
184
[* .{cmd, bat} ]
155
- end_of_line = crlf
185
+ end_of_line = crlf
0 commit comments