Skip to content

Instantly share code, notes, and snippets.

@akamsteeg
Created January 16, 2022 13:20
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save akamsteeg/f712a1e2aba8a6ac3be3a2ae3df18508 to your computer and use it in GitHub Desktop.
.editorconfig for C#
root = true
[*.cs]
indent_size = 2
indent_style = space
trim_trailing_whitespace = true
# Enable "this."
dotnet_style_qualification_for_field = true:warning
dotnet_style_qualification_for_property = true:warning
dotnet_style_qualification_for_method = true:warning
dotnet_style_qualification_for_method = true:warning
# use predefined type ("int") instead of framework names ("Int32")
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
# Access modifiers
dotnet_style_require_accessibility_modifiers = always:error
# Prefer "var"
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = true:suggestion
# Pattern match ("object is int i") over "is..as" dance
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
csharp_style_pattern_matching_over_as_with_null_check = true:warning
# Inline out variable
csharp_style_inlined_variable_declaration = true:warning
# Throw expressions
csharp_style_throw_expression = true:error
# File scoped namespaces
csharp_style_namespace_declarations = file_scoped:error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment