Skip to content

Instantly share code, notes, and snippets.

@InfiniteXyy
Last active February 19, 2025 09:51
Show Gist options
  • Save InfiniteXyy/7c52cadf1017ee4e44f86d03f89248d5 to your computer and use it in GitHub Desktop.
Save InfiniteXyy/7c52cadf1017ee4e44f86d03f89248d5 to your computer and use it in GitHub Desktop.
C# personal editorconfig
# Root EditorConfig file
root = true
# Global settings (applies to all files)
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
# TypeScript-like formatting for C#
[*.cs]
indent_style = space
indent_size = 2
tab_width = 2
max_line_length = 120
# C# specific rules
csharp_new_line_before_open_brace = none
csharp_new_line_between_method_declarations = true
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_space_after_cast = true
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_preserve_single_line_blocks = true
csharp_indent_braces = false
csharp_indent_block_contents = true
csharp_indent_labels = one_less_than_current
# Ensure else stays on the same line as the closing brace of if
csharp_new_line_before_else = false
csharp_new_line_before_catch = false
csharp_new_line_before_finally = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment