# Visual Studio Reference: https://docs.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options # Rider Reference: https://www.jetbrains.com/help/rider/EditorConfig_Index.html # Top-most EditorConfig file root = true [*] indent_style = space [*.{json,asmdef}] indent_size = 2 [*.cs] # Basic Text Settings indent_size = 4 insert_final_newline = true max_line_length = 120 trim_trailing_whitespace = true charset = utf-8 # C# Code Style Settings # Require accessibility modifiers (e.g., private, public), do not omit dotnet_style_require_accessibility_modifiers = always:warning # Avoid "this." unless necessary dotnet_style_qualification_for_field = false:warning dotnet_style_qualification_for_property = false:warning dotnet_style_qualification_for_method = false:warning dotnet_style_qualification_for_event = false:warning # Use language keywords (e.g., int) instead of framework type names (e.g., Int32) dotnet_style_predefined_type_for_locals_parameters_members = true:warning dotnet_style_predefined_type_for_member_access = true:warning # Prefer "var" csharp_style_var_for_built_in_types = true:warning csharp_style_var_when_type_is_apparent = true:warning csharp_style_var_elsewhere = true:warning # Prefer braces even for single-line statements csharp_prefer_braces = true:warning # Formatting details csharp_space_after_cast = false csharp_preserve_single_line_blocks = true csharp_space_within_single_line_array_initializer_braces = true # Naming Conventions # 1. Define symbol groups # All fields (variables) dotnet_naming_symbols.all_fields.applicable_kinds = field dotnet_naming_symbols.all_fields.applicable_accessibilities = * # Properties dotnet_naming_symbols.all_properties.applicable_kinds = property dotnet_naming_symbols.all_properties.applicable_accessibilities = * # 2. Define naming styles # camelCase dotnet_naming_style.style_camel_case.capitalization = camel_case # PascalCase dotnet_naming_style.style_pascal_case.capitalization = pascal_case # 3. Define rules # Rule: Use camelCase for all fields (both public and private) dotnet_naming_rule.fields_must_be_camel_case.symbols = all_fields dotnet_naming_rule.fields_must_be_camel_case.style = style_camel_case dotnet_naming_rule.fields_must_be_camel_case.severity = warning # Rule: Use PascalCase for properties dotnet_naming_rule.properties_must_be_pascal_case.symbols = all_properties dotnet_naming_rule.properties_must_be_pascal_case.style = style_pascal_case dotnet_naming_rule.properties_must_be_pascal_case.severity = warning