root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.cs]
# Namespace
dotnet_style_namespace_match_folder = true
csharp_style_namespace_declarations = file_scoped

# var preferences
csharp_style_var_for_built_in_types = true
csharp_style_var_when_type_is_apparent = true
csharp_style_var_elsewhere = true

# Expression-bodied members
csharp_style_expression_bodied_methods = when_on_single_line
csharp_style_expression_bodied_properties = true
csharp_style_expression_bodied_accessors = true

# Pattern matching
csharp_style_pattern_matching_over_is_with_cast_check = true
csharp_style_pattern_matching_over_as_with_null_check = true

# Null checking
csharp_style_conditional_delegate_call = true
csharp_style_throw_expression = true
csharp_style_prefer_null_check_over_type_check = true

# Braces
csharp_prefer_braces = when_multiline

# Using directives
csharp_using_directive_placement = outside_namespace

# New line preferences
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true

[*.{json,yml,yaml}]
indent_size = 2

[*.md]
trim_trailing_whitespace = false
