|
1 | | -[*.cs] |
| 1 | +# EditorConfig is awesome: https://EditorConfig.org |
| 2 | + |
| 3 | +# top-most EditorConfig file |
| 4 | +root = true |
| 5 | + |
| 6 | +# All files |
| 7 | +[*] |
| 8 | +charset = utf-8 |
| 9 | +insert_final_newline = true |
| 10 | +trim_trailing_whitespace = true |
| 11 | + |
| 12 | +# Code files |
| 13 | +[*.{cs,csx,vb,vbx}] |
2 | 14 | indent_size = 4 |
3 | 15 | indent_style = space |
4 | | -trim_trailing_whitespace = true |
5 | | -insert_final_newline = true |
| 16 | +tab_width = 4 |
| 17 | + |
| 18 | +# C# files |
| 19 | +[*.cs] |
| 20 | + |
| 21 | +# New line preferences |
| 22 | +csharp_new_line_before_open_brace = all |
| 23 | +csharp_new_line_before_else = true |
| 24 | +csharp_new_line_before_catch = true |
| 25 | +csharp_new_line_before_finally = true |
| 26 | +csharp_new_line_before_members_in_object_initializers = true |
| 27 | +csharp_new_line_before_members_in_anonymous_types = true |
| 28 | +csharp_new_line_between_query_expression_clauses = true |
| 29 | + |
| 30 | +# Indentation preferences |
| 31 | +csharp_indent_case_contents = true |
| 32 | +csharp_indent_switch_labels = true |
| 33 | +csharp_indent_labels = one_less_than_current |
| 34 | +csharp_indent_block_contents = true |
| 35 | +csharp_indent_braces = false |
| 36 | +csharp_indent_case_contents_when_block = false |
| 37 | + |
| 38 | +# Space preferences |
| 39 | +csharp_space_after_cast = false |
| 40 | +csharp_space_after_keywords_in_control_flow_statements = true |
| 41 | +csharp_space_between_parentheses = false |
| 42 | +csharp_space_before_colon_in_inheritance_clause = true |
| 43 | +csharp_space_after_colon_in_inheritance_clause = true |
| 44 | +csharp_space_around_binary_operators = before_and_after |
| 45 | +csharp_space_between_method_declaration_parameter_list_parentheses = false |
| 46 | +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false |
| 47 | +csharp_space_between_method_call_name_and_opening_parenthesis = false |
| 48 | +csharp_space_between_method_call_parameter_list_parentheses = false |
| 49 | +csharp_space_between_method_call_empty_parameter_list_parentheses = false |
| 50 | +csharp_space_after_comma = true |
| 51 | +csharp_space_after_dot = false |
| 52 | + |
| 53 | +# Organize usings |
| 54 | +dotnet_sort_system_directives_first = true |
| 55 | +dotnet_separate_import_directive_groups = false |
| 56 | + |
| 57 | +# Code style rules |
| 58 | +[*.{cs,vb}] |
| 59 | +dotnet_style_qualification_for_field = false:silent |
| 60 | +dotnet_style_qualification_for_property = false:silent |
| 61 | +dotnet_style_qualification_for_method = false:silent |
| 62 | +dotnet_style_qualification_for_event = false:silent |
| 63 | + |
| 64 | +# Language keywords vs BCL types preferences |
| 65 | +dotnet_style_predefined_type_for_locals_parameters_members = true:silent |
| 66 | +dotnet_style_predefined_type_for_member_access = true:silent |
| 67 | + |
| 68 | +# Modifier preferences |
| 69 | +dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent |
| 70 | +dotnet_style_readonly_field = true:suggestion |
| 71 | +csharp_preferred_modifier_order = public, private, protected, internal, static, extern, new, virtual, abstract, sealed, override, readonly, unsafe, volatile, async:suggestion |
| 72 | + |
| 73 | +# Expression-level preferences |
| 74 | +dotnet_style_object_initializer = true:suggestion |
| 75 | +dotnet_style_collection_initializer = true:suggestion |
| 76 | +dotnet_style_explicit_tuple_names = true:suggestion |
| 77 | +dotnet_style_prefer_inferred_tuple_names = true:suggestion |
| 78 | +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion |
| 79 | +dotnet_style_prefer_auto_properties = true:suggestion |
| 80 | +dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion |
| 81 | +dotnet_style_prefer_conditional_expression_over_return = true:suggestion |
| 82 | +dotnet_style_prefer_compound_assignment = true:suggestion |
| 83 | + |
| 84 | +# Modern .NET preferences |
| 85 | +dotnet_style_prefer_simplified_boolean_expressions = true:suggestion |
| 86 | +dotnet_style_prefer_simplified_interpolation = true:suggestion |
| 87 | +dotnet_style_namespace_match_folder = true:suggestion |
| 88 | +dotnet_style_allow_multiple_blank_lines_experimental = false:silent |
| 89 | +dotnet_style_allow_statement_immediately_after_block_experimental = false:silent |
| 90 | + |
| 91 | +# C# Code Style Rules |
| 92 | +[*.cs] |
| 93 | +# var preferences - Use var everywhere (modern C# style) |
| 94 | +csharp_style_var_for_built_in_types = true:suggestion |
| 95 | +csharp_style_var_when_type_is_apparent = true:suggestion |
| 96 | +csharp_style_var_elsewhere = true:suggestion |
| 97 | + |
| 98 | +# Expression-bodied members |
| 99 | +csharp_style_expression_bodied_methods = false:silent |
| 100 | +csharp_style_expression_bodied_constructors = false:silent |
| 101 | +csharp_style_expression_bodied_operators = false:silent |
| 102 | +csharp_style_expression_bodied_properties = true:silent |
| 103 | +csharp_style_expression_bodied_indexers = true:silent |
| 104 | +csharp_style_expression_bodied_accessors = true:silent |
| 105 | +csharp_style_expression_bodied_lambdas = true:silent |
| 106 | +csharp_style_expression_bodied_local_functions = false:silent |
| 107 | + |
| 108 | +# Pattern matching preferences |
| 109 | +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion |
| 110 | +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion |
| 111 | +csharp_style_prefer_switch_expression = true:suggestion |
| 112 | +csharp_style_prefer_pattern_matching = true:silent |
| 113 | +csharp_style_prefer_not_pattern = true:suggestion |
| 114 | + |
| 115 | +# Null-checking preferences |
| 116 | +csharp_style_throw_expression = true:suggestion |
| 117 | +csharp_style_prefer_null_check_over_type_check = true:suggestion |
| 118 | +csharp_style_conditional_delegate_call = true:suggestion |
| 119 | + |
| 120 | +# Code block preferences |
| 121 | +csharp_prefer_braces = true:silent |
| 122 | +csharp_prefer_simple_using_statement = true:suggestion |
| 123 | +csharp_prefer_static_local_function = true:suggestion |
| 124 | + |
| 125 | +# 'using' directive preferences |
| 126 | +csharp_using_directive_placement = outside_namespace:suggestion |
| 127 | + |
| 128 | +#### Modern C# Features (C# 9.0+) #### |
| 129 | + |
| 130 | +# C# 9.0 - Target-typed new expressions |
| 131 | +csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion |
| 132 | + |
| 133 | +# C# 9.0 - Prefer index operator |
| 134 | +csharp_style_prefer_index_operator = true:suggestion |
| 135 | +csharp_style_prefer_range_operator = true:suggestion |
| 136 | + |
| 137 | +# C# 10.0 - Namespace preferences |
| 138 | +csharp_style_namespace_declarations = file_scoped:suggestion |
| 139 | + |
| 140 | +# C# 11.0 - Prefer tuple swap |
| 141 | +csharp_style_prefer_tuple_swap = true:suggestion |
| 142 | + |
| 143 | +# C# 12.0 - Primary constructors |
| 144 | +csharp_style_prefer_primary_constructors = true:suggestion |
| 145 | + |
| 146 | +# Modern null checking (C# 8.0+) |
| 147 | +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion |
| 148 | +dotnet_style_coalesce_expression = true:suggestion |
| 149 | +dotnet_style_null_propagation = true:suggestion |
| 150 | +dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion |
| 151 | +dotnet_style_prefer_conditional_expression_over_return = true:suggestion |
| 152 | + |
| 153 | +# C# 9.0+ - Discard preferences |
| 154 | +csharp_style_unused_value_expression_statement_preference = discard_variable:silent |
| 155 | +csharp_style_unused_value_assignment_preference = discard_variable:suggestion |
| 156 | + |
| 157 | +# C# 8.0+ - Inline variable declaration |
| 158 | +csharp_style_inlined_variable_declaration = true:suggestion |
| 159 | + |
| 160 | +# C# 7.0+ - Prefer local over anonymous function |
| 161 | +csharp_style_pattern_local_over_anonymous_function = true:suggestion |
| 162 | + |
| 163 | +# C# 9.0+ - Extended property patterns |
| 164 | +csharp_style_prefer_extended_property_pattern = true:suggestion |
| 165 | + |
| 166 | +# Modern parameter preferences |
| 167 | +dotnet_code_quality_unused_parameters = all:suggestion |
| 168 | + |
| 169 | +# Modern simplification preferences |
| 170 | +dotnet_style_prefer_simplified_boolean_expressions = true:suggestion |
| 171 | +dotnet_style_prefer_simplified_interpolation = true:suggestion |
| 172 | + |
| 173 | +# C# 10.0+ - Constant pattern preferences |
| 174 | +csharp_style_prefer_top_level_statements = false:silent |
| 175 | + |
| 176 | +# Collection initialization |
| 177 | +dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion |
| 178 | + |
| 179 | +# Method group conversion |
| 180 | +csharp_style_prefer_method_group_conversion = true:silent |
| 181 | + |
| 182 | +# Expression preferences for modern C# |
| 183 | +csharp_style_prefer_local_over_anonymous_function = true:suggestion |
| 184 | +csharp_style_prefer_readonly_struct = true:suggestion |
| 185 | +csharp_style_prefer_readonly_struct_member = true:suggestion |
| 186 | + |
| 187 | +# File header (optional - uncomment if needed) |
| 188 | +# file_header_template = Copyright (c) CppCXY. All rights reserved. |
| 189 | + |
| 190 | +# Naming Conventions are handled by Rider/.DotSettings |
| 191 | +# We keep them relaxed here to avoid conflicts |
0 commit comments