The pattern book
Rules
Every preference DressSharp understands, in the order dotnet dress init writes them. Each key controls exactly one formatting rule. Every preference also accepts unset, which selects no outcome so the rule makes no change.
| Preference | Rule | Default |
|---|---|---|
charset |
Charset | utf-8 |
end_of_line |
End of line | unset |
insert_final_newline |
Insert final newline | true |
trim_trailing_whitespace |
Trim trailing whitespace | true |
| Preference | Rule | Default |
|---|---|---|
indent_style |
Style | space |
indent_size |
Size | 4 |
tab_width |
Tab width | 4 |
csharp_indent_labels |
Labels | one_less_than_current |
csharp_indent_block_contents |
Block contents | true |
csharp_indent_braces |
Braces | false |
dress_switch_expression_indentation |
Switch expression | indented |
dress_lambda_block_indentation |
Lambda block | indented |
csharp_indent_case_contents |
Switch statements · Case contents | true |
csharp_indent_switch_labels |
Switch statements · Switch labels | true |
csharp_indent_case_contents_when_block |
Switch statements · Case contents when block | false |
dress_object_initializer_indentation |
Initializers and collections · Object initializer | indented |
dress_collection_initializer_indentation |
Initializers and collections · Collection initializer | indented |
dress_array_initializer_indentation |
Initializers and collections · Array initializer | indented |
dress_with_initializer_indentation |
Initializers and collections · With initializer | indented |
dress_collection_expression_indentation |
Initializers and collections · Collection expression outside arguments | indented |
dress_collection_expression_argument_indentation |
Initializers and collections · Collection expression argument | not_indented |
| Preference | Rule | Default |
|---|---|---|
max_line_length |
Maximum line length | 160 |
dress_arguments_layout |
Lists · Arguments | auto |
dress_parameters_layout |
Lists · Parameters | auto |
dress_collection_expressions_layout |
Lists · Collection expressions | auto |
dress_base_type_lists_layout |
Lists · Base type lists | auto |
dress_constraint_clauses_layout |
Lists · Constraint clauses | auto |
dress_attributes_layout |
Lists · Attributes | auto |
dress_arguments_closing_delimiter_position |
Closing delimiters · Arguments | after_last_item |
dress_parameters_closing_delimiter_position |
Closing delimiters · Parameters | own_line |
dress_object_initializer_closing_delimiter_position |
Closing delimiters · Object initializers | unset |
dress_collection_initializer_closing_delimiter_position |
Closing delimiters · Collection initializers | unset |
dress_array_initializer_closing_delimiter_position |
Closing delimiters · Array initializers | unset |
dress_with_initializer_closing_delimiter_position |
Closing delimiters · With initializers | unset |
dress_collection_expression_closing_delimiter_position |
Closing delimiters · Collection expressions | unset |
dress_object_initializer_layout |
Initializers · Object initializer | auto |
dress_collection_initializer_layout |
Initializers · Collection initializer | auto |
dress_array_initializer_layout |
Initializers · Array initializer | auto |
dress_with_initializer_layout |
Initializers · With initializer | auto |
dress_member_access_chains_layout |
Expressions · Member access chains | auto |
dress_binary_expressions_layout |
Expressions · Binary expressions | auto |
dress_binary_expression_indentation |
Expressions · Binary expression indentation | precedence |
dress_conditional_expressions_layout |
Expressions · Conditional expressions | auto |
dress_nested_conditional_style |
Expressions · Nested ternary style | decision_ladder |
dotnet_style_operator_placement_when_wrapping |
Expressions · Operator position | beginning_of_line |
dress_query_clauses_layout |
Expressions · Query clauses | auto |
| Preference | Rule | Default |
|---|---|---|
csharp_new_line_before_open_brace |
Newlines · Before open brace | accessors,anonymous_methods,anonymous_types,control_blocks,events,indexers,lambdas,local_functions,methods,properties,types |
csharp_new_line_before_else |
Newlines · Before else | true |
csharp_new_line_before_catch |
Newlines · Before catch | true |
csharp_new_line_before_finally |
Newlines · Before finally | true |
csharp_new_line_before_members_in_object_initializers |
Newlines · Before members in object initializers | true |
csharp_new_line_before_members_in_anonymous_types |
Newlines · Before members in anonymous types | true |
csharp_new_line_between_query_expression_clauses |
Newlines · Between query expression clauses | true |
dress_multiline_parameter_list_open_brace_position |
Newlines · Open brace position | same_line |
csharp_preserve_single_line_blocks |
Preserve single line · Blocks | false |
csharp_preserve_single_line_statements |
Preserve single line · Statements | false |
dress_preserve_trivial_single_line_blocks |
Preserve single line · Trivial blocks | true |
csharp_preferred_modifier_order |
Preferred modifier order | public,protected,internal,private,file,new,static,abstract,virtual,sealed,override,readonly,unsafe,required,volatile,async |
dress_namespace_style |
Namespace style | file_scoped |
dress_method_body |
Body styles · Method | unset |
dress_constructor_body |
Body styles · Constructor | unset |
dress_operator_body |
Body styles · Operator | unset |
dress_property_body |
Body styles · Property | expression |
dress_indexer_body |
Body styles · Indexer | expression |
dress_accessor_body |
Body styles · Accessor | expression |
dress_lambda_body |
Body styles · Lambda | expression |
dress_embedded_statement_placement |
Embedded statements · Control statement body placement | next_line |
dress_embedded_statement_braces |
Embedded statements · Braces | balanced |
dress_braces_for_multiline_statement_header |
Embedded statements · Braces for multiline statement header | true |
| Preference | Rule | Default |
|---|---|---|
dotnet_sort_system_directives_first |
Sort system directives first | true |
dotnet_separate_import_directive_groups |
Separate import directive groups | false |
dress_global_using_order |
Global using order | first |
dress_using_kind_order |
Using kind order | ordinary,static,alias |
| Preference | Rule | Default |
|---|---|---|
dress_blank_lines_around_namespaces |
Around namespaces | 1 |
dress_blank_lines_around_types |
Around types | 1 |
dress_blank_lines_between_members |
Between members | unset |
dress_blank_lines_between_using_groups |
Between using groups | 0 |
dress_blank_lines_between_member_categories |
Between member categories | 1 |
dress_max_consecutive_blank_lines |
Max consecutive blank lines | 1 |
| Preference | Rule | Default |
|---|---|---|
dress_line_comment_spacing |
Line comments · Spacing | single |
dress_block_comment_spacing |
Block comments · Spacing | single |
dress_attached_comment_placement |
Attached comment placement | auto |
dress_comment_align |
Alignment | true |
dress_xml_comment_placement |
XML documentation · Placement | attached |
dress_xml_element_layout |
XML documentation · Element layout | unset |