Skip to content

Commit fd32a8a

Browse files
committed
Add C# styles to EditorConfig [ci skip]
1 parent 62de1cb commit fd32a8a

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

.editorconfig

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,36 @@ charset = utf-8
2121
indent_style = space
2222
indent_size = 4
2323
max_line_length = 100
24+
25+
[*.cs]
26+
# Prefer "var" everywhere
27+
csharp_style_var_for_built_in_types = true:suggestion
28+
csharp_style_var_when_type_is_apparent = true:suggestion
29+
csharp_style_var_elsewhere = true:suggestion
30+
31+
# Prefer method-like constructs to have a block body
32+
csharp_style_expression_bodied_methods = false:none
33+
csharp_style_expression_bodied_constructors = false:none
34+
csharp_style_expression_bodied_operators = false:none
35+
36+
# Prefer property-like constructs to have an expression-body
37+
csharp_style_expression_bodied_properties = true:none
38+
csharp_style_expression_bodied_indexers = true:none
39+
csharp_style_expression_bodied_accessors = true:none
40+
41+
# Suggest more modern language features when available
42+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
43+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
44+
csharp_style_inlined_variable_declaration = true:suggestion
45+
csharp_style_throw_expression = true:suggestion
46+
csharp_style_conditional_delegate_call = true:suggestion
47+
csharp_prefer_simple_default_expression = true:suggestion
48+
49+
# Spacing
50+
csharp_space_after_cast = false
51+
csharp_space_after_keywords_in_control_flow_statements = true
52+
csharp_space_between_method_declaration_parameter_list_parentheses = false
53+
54+
# Wrapping
55+
csharp_preserve_single_line_statements = true
56+
csharp_preserve_single_line_blocks = true

0 commit comments

Comments
 (0)