Skip to content

Instantly share code, notes, and snippets.

@geowarin
Created February 5, 2022 01:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geowarin/03a8133c10bc4f103dda3167f7502feb to your computer and use it in GitHub Desktop.
Save geowarin/03a8133c10bc4f103dda3167f7502feb to your computer and use it in GitHub Desktop.
C# editor config
# https://google.github.io/styleguide/csharp-style.html
[*.cs]
indent_style = space
indent_size = 2
tab_width = 4
insert_final_newline = true
max_line_length = 100
# Microsoft .NET properties
csharp_prefer_braces = true
csharp_indent_braces = false
csharp_new_line_before_else = false
csharp_new_line_before_catch = false
csharp_new_line_before_finally = false
csharp_new_line_before_open_brace = accessors, control_blocks, events, indexers, properties
# ReSharper properties
resharper_align_multiline_argument = true
resharper_align_multiline_parameter = true
resharper_allow_comment_after_lbrace = true
resharper_blank_lines_before_block_statements = 1
resharper_continuous_indent_multiplier = 2
resharper_csharp_blank_lines_around_field = 0
resharper_csharp_blank_lines_around_type = 0
resharper_csharp_empty_block_style = together
resharper_csharp_int_align_comments = true
resharper_csharp_other_braces = end_of_line
resharper_space_within_empty_braces = false
resharper_use_continuous_indent_inside_initializer_braces = false
# Style Definitions
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
dotnet_naming_style.camel_case_style.capitalization = camel_case
dotnet_naming_style.I_prefix_style.required_prefix = I
dotnet_naming_style.I_prefix_style.capitalization = pascal_case
dotnet_naming_style.lower_camel_case_style.required_prefix = _
dotnet_naming_style.lower_camel_case_style.capitalization = camel_case
# Names of private, protected, internal and protected internal fields and properties: _camelCase
dotnet_naming_rule.private_rule.severity = warning
dotnet_naming_rule.private_rule.symbols = private_fields
dotnet_naming_rule.private_rule.style = lower_camel_case_style
dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private, protected, internal, protected_internal, private_protected
# Use PascalCase for public fields
dotnet_naming_rule.pascal_case_for_public_fields.severity = warning
dotnet_naming_rule.pascal_case_for_public_fields.symbols = public_fields
dotnet_naming_rule.pascal_case_for_public_fields.style = pascal_case_style
dotnet_naming_symbols.public_fields.applicable_kinds = field
dotnet_naming_symbols.public_fields.applicable_accessibilities = public
# Interfaces must be PascalCase and have an I prefix
dotnet_naming_rule.interfaces_start_with_I.severity = warning
dotnet_naming_rule.interfaces_start_with_I.symbols = any_interface
dotnet_naming_rule.interfaces_start_with_I.style = I_prefix_style
dotnet_naming_symbols.any_interface.applicable_accessibilities = *
dotnet_naming_symbols.any_interface.applicable_kinds = interface
# Classes, structs, methods, enums, events, properties, namespaces, delegates must be PascalCase
dotnet_naming_rule.general_naming.severity = warning
dotnet_naming_rule.general_naming.symbols = general
dotnet_naming_rule.general_naming.style = pascal_case_style
dotnet_naming_symbols.general.applicable_kinds = class, struct, enum, property, method, event, namespace, delegate, type_parameter
dotnet_naming_symbols.general.applicable_accessibilities = *
# Everything else is camelCase
dotnet_naming_rule.everything_else_naming.severity = warning
dotnet_naming_rule.everything_else_naming.symbols = everything_else
dotnet_naming_rule.everything_else_naming.style = camel_case_style
dotnet_naming_symbols.everything_else.applicable_kinds = *
dotnet_naming_symbols.everything_else.applicable_accessibilities = *
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment