Skip to content

Instantly share code, notes, and snippets.

@detroitpro
Created June 22, 2017 20:53
Show Gist options
  • Save detroitpro/382fc3f8c790104f24c07b33f23f119e to your computer and use it in GitHub Desktop.
Save detroitpro/382fc3f8c790104f24c07b33f23f119e to your computer and use it in GitHub Desktop.
Editor Config for C# / VS2017 / R#
root=true
[*]
indent_style = tab
indent_size = 4
[*.cs]
# Don't use 'this.'/'Me.' prefix for anything
dotnet_style_qualification_for_field = false:error
dotnet_style_qualification_for_property = false:error
dotnet_style_qualification_for_method = false:error
dotnet_style_qualification_for_event = false:error
# Use language keywords over framework type names for type references
# i.e. prefer 'string' over 'String'
dotnet_style_predefined_type_for_locals_parameters_members = true:error
dotnet_style_predefined_type_for_member_access = true:error
# Prefer object/collection initializers
# This is a suggestion because there are cases where this is necessary
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
# Prefer using 'foo ?? bar' over 'foo != null ? foo : bar'
dotnet_style_coalesce_expression = true:error
# Prefer using '?.' over ternary null checking where possible
dotnet_style_null_propagation = true:error
# Use 'var' in all cases where it can be used
csharp_style_var_for_built_in_types = true:error
csharp_style_var_when_type_is_apparent = true:error
csharp_style_var_elsewhere = true:error
# Newline settings
# Unsure where docs are. Got these from https://github.com/dotnet/roslyn/blob/master/.editorconfig
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
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
# Prefer expression-bodied methods, constructors, operators, etc.
csharp_style_expression_bodied_methods = true:suggestion
csharp_style_expression_bodied_constructors = true:suggestion
csharp_style_expression_bodied_operators = true:suggestion
csharp_style_expression_bodied_properties = true:suggestion
csharp_style_expression_bodied_indexers = true:suggestion
csharp_style_expression_bodied_accessors = true:suggestion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment