11# Remove the line below if you want to inherit .editorconfig settings from higher directories
2+ # https://docs.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options?view=vs-2019#supported-settings
23root = true
34
45[* ]
@@ -12,137 +13,163 @@ trim_trailing_whitespace = false
1213# C# files
1314[* .cs ]
1415# Indentation options
15- # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#indent
1616
1717indent_size = 2
1818indent_style = space
1919tab_width = 2
2020
21- csharp_indent_case_contents = true
22- csharp_indent_block_contents = true
23- csharp_indent_braces = false
24- csharp_indent_switch_labels = true
25- csharp_indent_labels = one_less_than_current
26-
2721# New line preferences
28- # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#c-formatting-settings
29-
30- csharp_new_line_before_catch = true
31- csharp_new_line_before_finally = true
32- csharp_new_line_before_else = true
33- csharp_new_line_before_members_in_anonymous_types = true
34- csharp_new_line_before_members_in_object_initializers = false
35- csharp_new_line_before_open_brace = types,methods
36- csharp_new_line_between_query_expression_clauses = true
37-
3822end_of_line = crlf
3923insert_final_newline = false
4024
4125# ### .NET Coding Conventions ####
26+ # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-language-conventions?view=vs-2019#net-code-style-settings
4227
4328# Organize usings
44- # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#usings
45- csharp_using_directive_placement = outside_namespace:silent
29+ # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-formatting-conventions?view=vs-2019#organize-using-directives
30+ dotnet_separate_import_directive_groups = false
4631dotnet_sort_system_directives_first = true
4732
48- # Style - qualification options
49- # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#this_and_me
33+ # this. and Me. preferences
34+ # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-language-conventions?view=vs-2019#this-and-me
35+ dotnet_style_qualification_for_event = false :suggestion
5036dotnet_style_qualification_for_field = false :suggestion
51- dotnet_style_qualification_for_property = false :suggestion
5237dotnet_style_qualification_for_method = false :suggestion
53- dotnet_style_qualification_for_event = false :suggestion
38+ dotnet_style_qualification_for_property = false :suggestion
5439
55- # Language keywords instead of framework type names for type references
56- # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#language_keywords
40+ # Language keywords vs BCL types preferences
41+ # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-language-conventions?view=vs-2019#language-keywords
5742dotnet_style_predefined_type_for_locals_parameters_members = true :warning
5843dotnet_style_predefined_type_for_member_access = true :warning
5944
6045# Parentheses preferences
61- # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference #parentheses
46+ # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-language-conventions?view=vs-2019 #parentheses-preferences
6247dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion
63- dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion
6448dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
6549dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion
50+ dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion
6651
6752# Modifier preferences
68- # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#normalize_modifiers
53+ # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-language-conventions?view=vs-2019#normalize-modifiers
6954dotnet_style_require_accessibility_modifiers = always:warning
70- csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
71- dotnet_style_readonly_field = true :warning
72- csharp_prefer_static_local_function = true :suggestion
7355
7456# Expression-level preferences
75- # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#expression_level
76-
77- dotnet_style_object_initializer = true :suggestion
57+ # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-language-conventions?view=vs-2019#expression-level-preferences
7858dotnet_style_collection_initializer = true :suggestion
7959dotnet_style_explicit_tuple_names = true :suggestion
80- dotnet_style_prefer_inferred_tuple_names = true :suggestion
81- dotnet_style_prefer_inferred_anonymous_type_member_names = true :suggestion
60+ dotnet_style_object_initializer = true :suggestion
8261dotnet_style_prefer_auto_properties = true :suggestion
62+ dotnet_style_prefer_compound_assignment = true :suggestion
63+ dotnet_style_prefer_conditional_expression_over_assignment = true :suggestion
64+ dotnet_style_prefer_conditional_expression_over_return = true :suggestion
65+ dotnet_style_prefer_inferred_anonymous_type_member_names = false :suggestion
66+ dotnet_style_prefer_inferred_tuple_names = true :suggestion
8367dotnet_style_prefer_is_null_check_over_reference_equality_method = true :suggestion
84- dotnet_style_prefer_conditional_expression_over_assignment = false :suggestion
85- dotnet_style_prefer_conditional_expression_over_return = false :suggestion
86- csharp_prefer_simple_default_expression = true :suggestion
87- csharp_prefer_braces = true :suggestion
88- csharp_prefer_simple_using_statement = true :suggestion
89-
90- # Expression-level preferences
91- csharp_style_deconstructed_variable_declaration = true :suggestion
92- csharp_style_inlined_variable_declaration = true :suggestion
93- csharp_style_pattern_local_over_anonymous_function = true :suggestion
94- csharp_style_prefer_index_operator = true :suggestion
95- csharp_style_prefer_range_operator = true :suggestion
96- csharp_style_unused_value_assignment_preference = discard_variable:suggestion
97- csharp_style_unused_value_expression_statement_preference = discard_variable:silent
9868
99- # Expression-bodied members
100- csharp_style_expression_bodied_methods = true :none
101- csharp_style_expression_bodied_constructors = false :suggestion
102- csharp_style_expression_bodied_operators = true :suggestion
103- csharp_style_expression_bodied_properties = true :suggestion
104- csharp_style_expression_bodied_indexers = true :suggestion
105- csharp_style_expression_bodied_accessors = true :suggestion
69+ # Null-checking preferences
70+ # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-language-conventions?view=vs-2019#null-checking-preferences
71+ dotnet_style_coalesce_expression = true :suggestion
72+ dotnet_style_null_propagation = true :suggestion
10673
107- # Pattern matching
108- csharp_style_pattern_matching_over_is_with_cast_check = true :suggestion
109- csharp_style_pattern_matching_over_as_with_null_check = true :suggestion
74+ # Field preferences
75+ dotnet_style_readonly_field = true :warning
11076
11177# Parameter preferences
112- dotnet_code_quality_unused_parameters = all:suggestion
78+ dotnet_code_quality_unused_parameters = all:warning
11379
11480# ### C# Coding Conventions ####
81+ # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-language-conventions?view=vs-2019#c-code-style-settings
11582
11683# var preferences
117- csharp_style_var_for_built_in_types = true :silent
118- csharp_style_var_when_type_is_apparent = true :silent
119- csharp_style_var_elsewhere = true :silent
84+ # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-language-conventions?view=vs-2019#implicit-and-explicit-types
85+ csharp_style_var_elsewhere = true :suggestion
86+ csharp_style_var_for_built_in_types = true :suggestion
87+ csharp_style_var_when_type_is_apparent = true :suggestion
88+
89+ # Expression-bodied members
90+ # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-language-conventions?view=vs-2019#expression-bodied-members
91+ csharp_style_expression_bodied_accessors = true :suggestion
92+ csharp_style_expression_bodied_constructors = false :warning
93+ csharp_style_expression_bodied_indexers = true :suggestion
94+ csharp_style_expression_bodied_lambdas = true :suggestion
95+ csharp_style_expression_bodied_local_functions = false :warning
96+ csharp_style_expression_bodied_methods = when_on_single_line:suggestion
97+ csharp_style_expression_bodied_operators = false :warning
98+ csharp_style_expression_bodied_properties = true :suggestion
12099
121- # Null checking preferences
122- # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#null_checking
123- csharp_style_throw_expression = false :none
100+ # Pattern matching preferences
101+ # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-language-conventions?view=vs-2019#pattern-matching
102+ csharp_style_pattern_matching_over_as_with_null_check = true :suggestion
103+ csharp_style_pattern_matching_over_is_with_cast_check = true :suggestion
104+ csharp_style_prefer_switch_expression = true :suggestion
105+
106+ # Null-checking preferences
107+ # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-language-conventions?view=vs-2019#c-null-checking-preferences
124108csharp_style_conditional_delegate_call = true :suggestion
125109
110+ # Modifier preferences
111+ csharp_prefer_static_local_function = true :suggestion
112+ csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent
113+
114+ # Code-block preferences
115+ # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-language-conventions?view=vs-2019#code-block-preferences
116+ csharp_prefer_braces = true :suggestion
117+ csharp_prefer_simple_using_statement = false :silent
118+
119+ # Expression-level preferences
120+ # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-language-conventions?view=vs-2019#c-expression-level-preferences
121+ csharp_prefer_simple_default_expression = true :suggestion
122+ csharp_style_deconstructed_variable_declaration = true :suggestion
123+ csharp_style_inlined_variable_declaration = true :suggestion
124+ csharp_style_pattern_local_over_anonymous_function = true :suggestion
125+ csharp_style_prefer_index_operator = true :suggestion
126+ csharp_style_prefer_range_operator = true :suggestion
127+ csharp_style_throw_expression = true :suggestion
128+ csharp_style_unused_value_assignment_preference = discard_variable:suggestion
129+ csharp_style_unused_value_expression_statement_preference = discard_variable:warning
130+
131+ # 'using' directive preferences
132+ csharp_using_directive_placement = outside_namespace:warning
133+
126134# ### C# Formatting Rules ####
135+ # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-formatting-conventions?view=vs-2019#c-formatting-settings
136+
137+ # New line preferences
138+ # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-formatting-conventions?view=vs-2019#new-line-options
139+ csharp_new_line_before_catch = true
140+ csharp_new_line_before_else = true
141+ csharp_new_line_before_finally = true
142+ csharp_new_line_before_members_in_anonymous_types = true
143+ csharp_new_line_before_members_in_object_initializers = true
144+ csharp_new_line_before_open_brace = properties,types
145+ csharp_new_line_between_query_expression_clauses = true
127146
128- # Spacing options
129- # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#spacing
147+ # Indentation preferences
148+ # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-formatting-conventions?view=vs-2019#indentation-options
149+ csharp_indent_block_contents = true
150+ csharp_indent_braces = false
151+ csharp_indent_case_contents = true
152+ csharp_indent_case_contents_when_block = false
153+ csharp_indent_labels = one_less_than_current
154+ csharp_indent_switch_labels = true
130155
156+ # Space preferences
157+ # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-formatting-conventions?view=vs-2019#spacing-options
158+ csharp_space_after_cast = true
131159csharp_space_after_colon_in_inheritance_clause = true
132- csharp_space_after_cast = false
133160csharp_space_after_comma = true
134161csharp_space_after_dot = false
135162csharp_space_after_keywords_in_control_flow_statements = true
136- csharp_space_before_colon_in_inheritance_clause = true
137- csharp_space_between_method_call_empty_parameter_list_parentheses = false
138163csharp_space_after_semicolon_in_for_statement = true
139164csharp_space_around_binary_operators = before_and_after
140- csharp_space_around_declaration_statements = do_not_ignore
165+ csharp_space_around_declaration_statements = false
166+ csharp_space_before_colon_in_inheritance_clause = true
141167csharp_space_before_comma = false
142168csharp_space_before_dot = false
143169csharp_space_before_open_square_brackets = false
144170csharp_space_before_semicolon_in_for_statement = false
145171csharp_space_between_empty_square_brackets = false
172+ csharp_space_between_method_call_empty_parameter_list_parentheses = false
146173csharp_space_between_method_call_name_and_opening_parenthesis = false
147174csharp_space_between_method_call_parameter_list_parentheses = false
148175csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
@@ -151,16 +178,15 @@ csharp_space_between_method_declaration_parameter_list_parentheses = false
151178csharp_space_between_parentheses = false
152179csharp_space_between_square_brackets = false
153180
154- # Wrapping options
155- # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#wrapping
156-
181+ # Wrapping preferences
182+ # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-formatting-conventions?view=vs-2019#wrap-options
157183csharp_preserve_single_line_blocks = true
158- csharp_preserve_single_line_statements = true
184+ csharp_preserve_single_line_statements = false
159185
160186# ### Naming styles ####
161187
162- # Naming Conventions
163- # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-naming-conventions
188+ # Naming rules
189+ # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-naming-conventions?view=vs-2019
164190
165191# Style Definitions
166192dotnet_naming_style.pascal_case_style.capitalization = pascal_case
@@ -175,22 +201,15 @@ dotnet_naming_style.capital_i_prefix_style.capitalization = pascal_case
175201dotnet_naming_style.capital_t_prefix_style.required_prefix = T
176202dotnet_naming_style.capital_t_prefix_style.capitalization = pascal_case
177203
178- dotnet_naming_style.T_prefix_style.required_prefix = T
179- dotnet_naming_style.T_prefix_style.capitalization = pascal_case
180-
181- dotnet_naming_style.underscore_style.required_prefix = _
182- dotnet_naming_style.underscore_style.capitalization = camel_case
183-
184-
185- # Private static must be camelCase
186- dotnet_naming_rule.private_naming.severity = suggestion
204+ # Private static fields must be camelCase
205+ dotnet_naming_rule.private_naming.severity = warning
187206dotnet_naming_rule.private_naming.symbols = private_static
188207dotnet_naming_rule.private_naming.style = camel_case_style
189- dotnet_naming_symbols.private_static.applicable_kinds = property,event, field
208+ dotnet_naming_symbols.private_static.applicable_kinds = field
190209dotnet_naming_symbols.private_static.applicable_accessibilities = private, static
191210
192211# Use PascalCase for readonly static fields
193- dotnet_naming_rule.readonly_fields_should_be_pascal_case.severity = notice
212+ dotnet_naming_rule.readonly_fields_should_be_pascal_case.severity = suggestion
194213dotnet_naming_rule.readonly_fields_should_be_pascal_case.symbols = readonly_fields
195214dotnet_naming_rule.readonly_fields_should_be_pascal_case.style = pascal_case_style
196215dotnet_naming_symbols.readonly_fields.applicable_kinds = field
@@ -205,6 +224,12 @@ dotnet_naming_symbols.constant_fields.applicable_kinds = field
205224dotnet_naming_symbols.constant_fields.required_modifiers = const
206225dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
207226
227+ # Private fields must be camelCase
228+ dotnet_naming_rule.private_naming.severity = suggestion
229+ dotnet_naming_rule.private_naming.symbols = private
230+ dotnet_naming_rule.private_naming.style = camel_case_style
231+ dotnet_naming_symbols.private.applicable_kinds = field
232+ dotnet_naming_symbols.private.applicable_accessibilities = private
208233
209234# Use PascalCase for public fields
210235dotnet_naming_rule.pascal_case_for_public_fields.severity = warning
@@ -228,36 +253,7 @@ dotnet_naming_symbols.any_interface.applicable_kinds = interface
228253dotnet_naming_symbols.any_interface.applicable_accessibilities = *
229254
230255# Generics Type Parameters use PascalCase and are prefixed with uppercase 'T'
231- # https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces
232256dotnet_naming_symbols.type_parameter_group.applicable_kinds = type_parameter
233257dotnet_naming_rule.type_parameter_rule.symbols = type_parameter_group
234258dotnet_naming_rule.type_parameter_rule.style = capital_t_prefix_style
235259dotnet_naming_rule.type_parameter_rule.severity = warning
236-
237- # Private must be camelCase
238- dotnet_naming_rule.private_naming.severity = suggestion
239- dotnet_naming_rule.private_naming.symbols = private
240- dotnet_naming_rule.private_naming.style = camel_case_style
241- dotnet_naming_symbols.private.applicable_kinds = property,event,field
242- dotnet_naming_symbols.private.applicable_accessibilities = private
243-
244- # Internal must be camelCase with underscore
245- dotnet_naming_rule.underscore_internal_naming.severity = warning
246- dotnet_naming_rule.underscore_internal_naming.symbols = underscore_internal
247- dotnet_naming_rule.underscore_internal_naming.style = camel_case_style
248- dotnet_naming_symbols.underscore_internal.applicable_kinds = property,event,field
249- dotnet_naming_symbols.underscore_internal.applicable_accessibilities = internal
250-
251- # Type params must be PascalCase with T prefix
252- dotnet_naming_rule.T_prefix_naming.severity = warning
253- dotnet_naming_rule.T_prefix_naming.symbols = T_prefix
254- dotnet_naming_rule.T_prefix_naming.style = T_prefix_style
255- dotnet_naming_symbols.T_prefix.applicable_kinds = type_parameter
256- dotnet_naming_symbols.T_prefix.applicable_accessibilities = *
257-
258- # Everything else is camelCase
259- # dotnet_naming_rule.everything_else_naming.severity = warning
260- # dotnet_naming_rule.everything_else_naming.symbols = everything_else
261- # dotnet_naming_rule.everything_else_naming.style = camel_case_style
262- # dotnet_naming_symbols.everything_else.applicable_kinds = *
263- # dotnet_naming_symbols.everything_else.applicable_accessibilities = *
0 commit comments