|
| 1 | +root = true |
| 2 | + |
| 3 | +[*] |
| 4 | +charset = utf-8 |
| 5 | +end_of_line = lf |
| 6 | +insert_final_newline = true |
| 7 | +trim_trailing_whitespace = true |
| 8 | +indent_style = space |
| 9 | + |
| 10 | +[*.{csproj,props,json,xml,xsd}] |
| 11 | +indent_size = 2 |
| 12 | + |
| 13 | +[*.{cs,razor}] |
| 14 | +indent_size = 4 |
| 15 | + |
| 16 | +# Formatting errors |
| 17 | +dotnet_diagnostic.IDE0055.severity = warning |
| 18 | + |
| 19 | +# Bracing and newline preferences |
| 20 | +csharp_new_line_before_open_brace = all |
| 21 | +csharp_new_line_before_else = true |
| 22 | +csharp_new_line_before_members_in_object_initializers = true |
| 23 | +csharp_prefer_braces = false:suggestion |
| 24 | + |
| 25 | +# this. qualification |
| 26 | +dotnet_style_qualification_for_field = true:warning |
| 27 | +dotnet_style_qualification_for_method = true:warning |
| 28 | +dotnet_style_qualification_for_property = true:warning |
| 29 | +dotnet_style_qualification_for_event = true:warning |
| 30 | + |
| 31 | +# Switch style |
| 32 | +csharp_indent_case_contents = true |
| 33 | +csharp_indent_case_contents_when_block = false |
| 34 | +csharp_indent_switch_labels = false |
| 35 | + |
| 36 | +# Sort System.* using directives alphabetically, and place them before other usings |
| 37 | +dotnet_sort_system_directives_first = true |
| 38 | + |
| 39 | +# Leave code block on single line |
| 40 | +csharp_preserve_single_line_blocks = true |
| 41 | +# Leave statements and member declarations on the same line |
| 42 | +csharp_preserve_single_line_statements = true |
| 43 | + |
| 44 | +# Prefer no curly braces if allowed |
| 45 | +csharp_prefer_braces = false:suggestion |
| 46 | + |
| 47 | +# Block preferences |
| 48 | +csharp_style_expression_bodied_constructors = false:suggestion |
| 49 | +csharp_style_expression_bodied_methods = true:suggestion |
| 50 | +csharp_style_expression_bodied_operators = true:suggestion |
| 51 | +csharp_style_expression_bodied_properties = true:suggestion |
| 52 | + |
| 53 | +# Prefer out variables to be declared inline in the argument list of a method call when possible |
| 54 | +csharp_style_inlined_variable_declaration = true:suggestion |
| 55 | +# Prefer tuple names to ItemX properties |
| 56 | +dotnet_style_explicit_tuple_names = true:suggestion |
| 57 | +# Prefer the language keyword for member access expressions, instead of the type name, for types that have a keyword to represent them |
| 58 | +dotnet_style_predefined_type_for_member_access = true:suggestion |
| 59 | + |
| 60 | +# Prefer default over default(T) |
| 61 | +csharp_prefer_simple_default_expression = true:suggestion |
| 62 | +# Prefer objects to be initialized using object initializers when possible |
| 63 | +dotnet_style_object_initializer = true:suggestion |
| 64 | +# Prefer inferred tuple element names |
| 65 | +dotnet_style_prefer_inferred_tuple_names = true:suggestion |
| 66 | +# Prefer the language keyword for local variables, method parameters, and class members, instead of the type name, for types that have a keyword to represent them |
| 67 | +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion |
| 68 | + |
| 69 | +# Var preferences |
| 70 | +csharp_style_var_elsewhere = true:suggestion |
| 71 | +csharp_style_var_for_built_in_types = true:suggestion |
| 72 | +csharp_style_var_when_type_is_apparent = true:suggestion |
| 73 | + |
| 74 | +# Using directive preferences |
| 75 | +dotnet_sort_system_directives_first = true |
| 76 | +dotnet_separate_import_directive_groups = false |
| 77 | + |
| 78 | +# Prefer file scoped namespaces over braced namespaces |
| 79 | +csharp_style_namespace_declarations = file_scoped:warning |
| 80 | + |
| 81 | +# Prefer local functions over anonymous functions |
| 82 | +csharp_style_pattern_local_over_anonymous_function = true:suggestion |
| 83 | + |
| 84 | +# Prefer accessibility modifiers to be declared except for public interface members. This will currently not differ from always and will act as future proofing for if C# adds default interface methods. |
| 85 | +dotnet_style_require_accessibility_modifiers = for_non_interface_members:warning |
| 86 | + |
| 87 | +# When this rule is set to a list of modifiers, prefer the specified ordering. |
| 88 | +csharp_preferred_modifier_order = public,private,protected,internal,static,readonly,override,abstract,new:suggestion |
| 89 | + |
| 90 | +# Prefer pattern matching instead of is expression with type casts |
| 91 | +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion |
0 commit comments