1+ # 如果要从更高级别的目录继承 .editorconfig 设置,请删除以下行
2+ root = true
3+
4+ # c# 文件
5+ [* .cs ]
6+
7+ # ### Core EditorConfig 选项 ####
8+
9+ # 缩进和间距
10+ indent_size = 4
11+ indent_style = space
12+ tab_width = 4
13+
14+ # 新行首选项
15+ end_of_line = crlf
16+ insert_final_newline = false
17+
18+ # ### .NET 编码约定 ####
19+
20+ # 组织 Using
21+ dotnet_separate_import_directive_groups = true
22+ dotnet_sort_system_directives_first = true
23+ file_header_template = unset
24+
25+ # this. 和 Me. 首选项
26+ dotnet_style_qualification_for_event = false :suggestion
27+ dotnet_style_qualification_for_field = false
28+ dotnet_style_qualification_for_method = false :suggestion
29+ dotnet_style_qualification_for_property = false :suggestion
30+
31+ # 语言关键字与 bcl 类型首选项
32+ dotnet_style_predefined_type_for_locals_parameters_members = true :suggestion
33+ dotnet_style_predefined_type_for_member_access = false :suggestion
34+
35+ # 括号首选项
36+ dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion
37+ dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
38+ dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion
39+ dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion
40+
41+ # 修饰符首选项
42+ dotnet_style_require_accessibility_modifiers = for_non_interface_members
43+
44+ # 表达式级首选项
45+ dotnet_style_coalesce_expression = true
46+ dotnet_style_collection_initializer = true
47+ dotnet_style_explicit_tuple_names = true
48+ dotnet_style_namespace_match_folder = true
49+ dotnet_style_null_propagation = true
50+ dotnet_style_object_initializer = true
51+ dotnet_style_operator_placement_when_wrapping = beginning_of_line
52+ dotnet_style_prefer_auto_properties = true :suggestion
53+ dotnet_style_prefer_compound_assignment = true
54+ dotnet_style_prefer_conditional_expression_over_assignment = true
55+ dotnet_style_prefer_conditional_expression_over_return = true
56+ dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed
57+ dotnet_style_prefer_inferred_anonymous_type_member_names = true
58+ dotnet_style_prefer_inferred_tuple_names = true
59+ dotnet_style_prefer_is_null_check_over_reference_equality_method = true
60+ dotnet_style_prefer_simplified_boolean_expressions = true
61+ dotnet_style_prefer_simplified_interpolation = true
62+
63+ # 字段首选项
64+ dotnet_style_readonly_field = true
65+
66+ # 参数首选项
67+ dotnet_code_quality_unused_parameters = all
68+
69+ # 禁止显示首选项
70+ dotnet_remove_unnecessary_suppression_exclusions = 0
71+
72+ # 新行首选项
73+ dotnet_style_allow_multiple_blank_lines_experimental = false :suggestion
74+ dotnet_style_allow_statement_immediately_after_block_experimental = false :suggestion
75+
76+ # ### c# 编码约定 ####
77+
78+ # var 首选项
79+ csharp_style_var_elsewhere = true :suggestion
80+ csharp_style_var_for_built_in_types = false :suggestion
81+ csharp_style_var_when_type_is_apparent = true :suggestion
82+
83+ # Expression-bodied 成员
84+ csharp_style_expression_bodied_accessors = when_on_single_line:suggestion
85+ csharp_style_expression_bodied_constructors = false :suggestion
86+ csharp_style_expression_bodied_indexers = when_on_single_line:suggestion
87+ csharp_style_expression_bodied_lambdas = when_on_single_line:suggestion
88+ csharp_style_expression_bodied_local_functions = false :suggestion
89+ csharp_style_expression_bodied_methods = false :suggestion
90+ csharp_style_expression_bodied_operators = false :suggestion
91+ csharp_style_expression_bodied_properties = when_on_single_line:suggestion
92+
93+ # 模式匹配首选项
94+ csharp_style_pattern_matching_over_as_with_null_check = true
95+ csharp_style_pattern_matching_over_is_with_cast_check = true
96+ csharp_style_prefer_extended_property_pattern = true
97+ csharp_style_prefer_not_pattern = true
98+ csharp_style_prefer_pattern_matching = true :suggestion
99+ csharp_style_prefer_switch_expression = true
100+
101+ # Null 检查首选项
102+ csharp_style_conditional_delegate_call = true
103+
104+ # 修饰符首选项
105+ csharp_prefer_static_local_function = true
106+ csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
107+ csharp_style_prefer_readonly_struct = true
108+
109+ # 代码块首选项
110+ csharp_prefer_braces = true :suggestion
111+ csharp_prefer_simple_using_statement = true
112+ csharp_style_namespace_declarations = file_scoped:suggestion
113+ csharp_style_prefer_method_group_conversion = true
114+ csharp_style_prefer_top_level_statements = true
115+
116+ # 表达式级首选项
117+ csharp_prefer_simple_default_expression = true
118+ csharp_style_deconstructed_variable_declaration = true
119+ csharp_style_implicit_object_creation_when_type_is_apparent = true
120+ csharp_style_inlined_variable_declaration = true
121+ csharp_style_prefer_index_operator = true
122+ csharp_style_prefer_local_over_anonymous_function = true
123+ csharp_style_prefer_null_check_over_type_check = true
124+ csharp_style_prefer_range_operator = true
125+ csharp_style_prefer_tuple_swap = true
126+ csharp_style_prefer_utf8_string_literals = true
127+ csharp_style_throw_expression = true
128+ csharp_style_unused_value_assignment_preference = discard_variable:silent
129+ csharp_style_unused_value_expression_statement_preference = discard_variable
130+
131+ # "using" 指令首选项
132+ csharp_using_directive_placement = outside_namespace:suggestion
133+
134+ # 新行首选项
135+ csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false :suggestion
136+ csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = false :suggestion
137+ csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = false :suggestion
138+ csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false :suggestion
139+ csharp_style_allow_embedded_statements_on_same_line_experimental = false :suggestion
140+
141+ # ### C# 格式规则 ####
142+
143+ # 新行首选项
144+ csharp_new_line_before_catch = true
145+ csharp_new_line_before_else = true
146+ csharp_new_line_before_finally = true
147+ csharp_new_line_before_members_in_anonymous_types = true
148+ csharp_new_line_before_members_in_object_initializers = true
149+ csharp_new_line_before_open_brace = types,methods,properties,control_blocks,accessors
150+ csharp_new_line_between_query_expression_clauses = true
151+
152+ # 缩进首选项
153+ csharp_indent_block_contents = true
154+ csharp_indent_braces = false
155+ csharp_indent_case_contents = true
156+ csharp_indent_case_contents_when_block = true
157+ csharp_indent_labels = one_less_than_current
158+ csharp_indent_switch_labels = true
159+
160+ # 空格键首选项
161+ csharp_space_after_cast = false
162+ csharp_space_after_colon_in_inheritance_clause = true
163+ csharp_space_after_comma = true
164+ csharp_space_after_dot = false
165+ csharp_space_after_keywords_in_control_flow_statements = true
166+ csharp_space_after_semicolon_in_for_statement = true
167+ csharp_space_around_binary_operators = before_and_after
168+ csharp_space_around_declaration_statements = false
169+ csharp_space_before_colon_in_inheritance_clause = true
170+ csharp_space_before_comma = false
171+ csharp_space_before_dot = false
172+ csharp_space_before_open_square_brackets = false
173+ csharp_space_before_semicolon_in_for_statement = false
174+ csharp_space_between_empty_square_brackets = false
175+ csharp_space_between_method_call_empty_parameter_list_parentheses = false
176+ csharp_space_between_method_call_name_and_opening_parenthesis = false
177+ csharp_space_between_method_call_parameter_list_parentheses = false
178+ csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
179+ csharp_space_between_method_declaration_name_and_open_parenthesis = false
180+ csharp_space_between_method_declaration_parameter_list_parentheses = false
181+ csharp_space_between_parentheses = false
182+ csharp_space_between_square_brackets = false
183+
184+ # 包装首选项
185+ csharp_preserve_single_line_blocks = true
186+ csharp_preserve_single_line_statements = true
187+
188+ # ### 命名样式 ####
189+
190+ # 命名规则
191+
192+ dotnet_naming_rule.命名空间_should_be_pascalcase.severity = suggestion
193+ dotnet_naming_rule.命名空间_should_be_pascalcase.symbols = 命名空间
194+ dotnet_naming_rule.命名空间_should_be_pascalcase.style = pascalcase
195+
196+ dotnet_naming_rule.类型_should_be_pascalcase.severity = suggestion
197+ dotnet_naming_rule.类型_should_be_pascalcase.symbols = 类型
198+ dotnet_naming_rule.类型_should_be_pascalcase.style = pascalcase
199+
200+ dotnet_naming_rule.接口_should_be_interface.severity = suggestion
201+ dotnet_naming_rule.接口_should_be_interface.symbols = 接口
202+ dotnet_naming_rule.接口_should_be_interface.style = interface
203+
204+ dotnet_naming_rule.抽象类_should_be_abstractmethod.severity = suggestion
205+ dotnet_naming_rule.抽象类_should_be_abstractmethod.symbols = 抽象类
206+ dotnet_naming_rule.抽象类_should_be_abstractmethod.style = abstractmethod
207+
208+ dotnet_naming_rule.非字段成员_should_be_pascalcase.severity = suggestion
209+ dotnet_naming_rule.非字段成员_should_be_pascalcase.symbols = 非字段成员
210+ dotnet_naming_rule.非字段成员_should_be_pascalcase.style = pascalcase
211+
212+ dotnet_naming_rule.类型参数_should_be_pascalcase.severity = suggestion
213+ dotnet_naming_rule.类型参数_should_be_pascalcase.symbols = 类型参数
214+ dotnet_naming_rule.类型参数_should_be_pascalcase.style = pascalcase
215+
216+ dotnet_naming_rule.公共字段_should_be_pascalcase.severity = suggestion
217+ dotnet_naming_rule.公共字段_should_be_pascalcase.symbols = 公共字段
218+ dotnet_naming_rule.公共字段_should_be_pascalcase.style = pascalcase
219+
220+ dotnet_naming_rule.字段_should_be__camelcase.severity = suggestion
221+ dotnet_naming_rule.字段_should_be__camelcase.symbols = 字段
222+ dotnet_naming_rule.字段_should_be__camelcase.style = _camelcase
223+
224+ dotnet_naming_rule.局部参数_should_be_camelcase.severity = suggestion
225+ dotnet_naming_rule.局部参数_should_be_camelcase.symbols = 局部参数
226+ dotnet_naming_rule.局部参数_should_be_camelcase.style = camelcase
227+
228+ dotnet_naming_rule.异步方法_should_be_asyncmethod.severity = suggestion
229+ dotnet_naming_rule.异步方法_should_be_asyncmethod.symbols = 异步方法
230+ dotnet_naming_rule.异步方法_should_be_asyncmethod.style = asyncmethod
231+
232+ # 符号规范
233+
234+ dotnet_naming_symbols.命名空间.applicable_kinds = namespace
235+ dotnet_naming_symbols.命名空间.applicable_accessibilities = *
236+ dotnet_naming_symbols.命名空间.required_modifiers =
237+
238+ dotnet_naming_symbols.类型.applicable_kinds = class, struct, interface, enum
239+ dotnet_naming_symbols.类型.applicable_accessibilities = *
240+ dotnet_naming_symbols.类型.required_modifiers =
241+
242+ dotnet_naming_symbols.接口.applicable_kinds = interface
243+ dotnet_naming_symbols.接口.applicable_accessibilities = *
244+ dotnet_naming_symbols.接口.required_modifiers =
245+
246+ dotnet_naming_symbols.抽象类.applicable_kinds = class
247+ dotnet_naming_symbols.抽象类.applicable_accessibilities = *
248+ dotnet_naming_symbols.抽象类.required_modifiers = abstract
249+
250+ dotnet_naming_symbols.非字段成员.applicable_kinds = property, event, delegate, method, local_function
251+ dotnet_naming_symbols.非字段成员.applicable_accessibilities = *
252+ dotnet_naming_symbols.非字段成员.required_modifiers =
253+
254+ dotnet_naming_symbols.类型参数.applicable_kinds = type_parameter
255+ dotnet_naming_symbols.类型参数.applicable_accessibilities = *
256+ dotnet_naming_symbols.类型参数.required_modifiers =
257+
258+ dotnet_naming_symbols.字段.applicable_kinds = field
259+ dotnet_naming_symbols.字段.applicable_accessibilities = *
260+ dotnet_naming_symbols.字段.required_modifiers =
261+
262+ dotnet_naming_symbols.公共字段.applicable_kinds = field
263+ dotnet_naming_symbols.公共字段.applicable_accessibilities = public, internal
264+ dotnet_naming_symbols.公共字段.required_modifiers =
265+
266+ dotnet_naming_symbols.局部参数.applicable_kinds = parameter, local
267+ dotnet_naming_symbols.局部参数.applicable_accessibilities = *
268+ dotnet_naming_symbols.局部参数.required_modifiers =
269+
270+ dotnet_naming_symbols.异步方法.applicable_kinds = method, local_function
271+ dotnet_naming_symbols.异步方法.applicable_accessibilities = *
272+ dotnet_naming_symbols.异步方法.required_modifiers = async
273+
274+ # 命名样式
275+
276+ dotnet_naming_style.pascalcase.required_prefix =
277+ dotnet_naming_style.pascalcase.required_suffix =
278+ dotnet_naming_style.pascalcase.word_separator =
279+ dotnet_naming_style.pascalcase.capitalization = pascal_case
280+
281+ dotnet_naming_style.camelcase.required_prefix =
282+ dotnet_naming_style.camelcase.required_suffix =
283+ dotnet_naming_style.camelcase.word_separator =
284+ dotnet_naming_style.camelcase.capitalization = camel_case
285+
286+ dotnet_naming_style._camelcase.required_prefix = _
287+ dotnet_naming_style._camelcase.required_suffix =
288+ dotnet_naming_style._camelcase.word_separator =
289+ dotnet_naming_style._camelcase.capitalization = camel_case
290+
291+ dotnet_naming_style.interface.required_prefix = I
292+ dotnet_naming_style.interface.required_suffix =
293+ dotnet_naming_style.interface.word_separator =
294+ dotnet_naming_style.interface.capitalization = pascal_case
295+
296+ dotnet_naming_style.abstractmethod.required_prefix =
297+ dotnet_naming_style.abstractmethod.required_suffix = Base
298+ dotnet_naming_style.abstractmethod.word_separator =
299+ dotnet_naming_style.abstractmethod.capitalization = pascal_case
300+
301+ dotnet_naming_style.asyncmethod.required_prefix =
302+ dotnet_naming_style.asyncmethod.required_suffix = Async
303+ dotnet_naming_style.asyncmethod.word_separator =
304+ dotnet_naming_style.asyncmethod.capitalization = pascal_case
0 commit comments