Skip to content

Latest commit

 

History

History
2094 lines (1948 loc) · 48.7 KB

README.md

File metadata and controls

2094 lines (1948 loc) · 48.7 KB

.NET EditorConfig

Welcome

The .editorconfig file provided in this repo contains opinionated settings. Feel free to use as is or update to your liking.

For descriptions and examples of the rules in the editor config, see below
(Includes Table of Content)


Table of Content


Rules

1. indent_size

Description: Defines the number of spaces used for each indentation level.


2. indent_style

Description: Defines whether to use spaces or tabs for indentation.


3. tab_width

Description: Sets the number of columns used to represent a tab character if indent_style=tab.


4. end_of_line

Description: Sets the line ending character(s) to use (e.g., crlf for Windows).


5. insert_final_newline

Description: Specifies whether to ensure the file ends with a newline.


6. dotnet_separate_import_directive_groups

Description: Controls whether using directives are separated into groups by blank lines.


7. dotnet_sort_system_directives_first

Description: Enforces whether 'System' namespaces come first in usings.


8. file_header_template

Description: Controls the file header text inserted in new files.


9. dotnet_style_qualification_for_event

Description: Enforces use of this. qualifier for events.

Examples
When True

this.eventHandler?.Invoke(this, EventArgs.Empty);  

When False

eventHandler?.Invoke(this, EventArgs.Empty);  

10. dotnet_style_qualification_for_field

Description: Enforces use of this. qualifier for fields.

Examples
When True

this.myField = 10;  

When False

myField = 10;  

11. dotnet_style_qualification_for_method

Description: Enforces use of this. qualifier for methods.

Examples
When True

this.DoSomething();  

When False

DoSomething();  

12. dotnet_style_qualification_for_property

Description: Enforces use of this. qualifier for properties.

Examples
When True

this.MyProperty = 5;  

When False

MyProperty = 5;  

13. dotnet_style_predefined_type_for_locals_parameters_members

Description: Prefers language keywords (e.g., int) over BCL types (e.g., Int32).

Examples
When True

int x = 0;  

When False

Int32 x = 0;  

14. dotnet_style_predefined_type_for_member_access

Description: Prefers language keywords when accessing static members.

Examples
When True

string.Empty;  

When False

String.Empty;  

15. dotnet_style_parentheses_in_arithmetic_binary_operators

Description: Enforces parentheses around arithmetic expressions for clarity.

Examples
Option 1

(a + b) * c;  

Option 2

a + b * c;  

16. dotnet_style_parentheses_in_other_binary_operators

Description: Enforces parentheses for non-arithmetic binary operators.

Examples
Option 1

(x & y) == 0;  

Option 2

x & y == 0;  

17. dotnet_style_parentheses_in_other_operators

Description: Controls parentheses usage for cast/unary operators.

Examples
Option 1

(int)x + 1;  

Option 2

(int)x + (1);  

18. dotnet_style_parentheses_in_relational_binary_operators

Description: Enforces parentheses around relational operators.

Examples
Option 1

(a < b) == true;  

Option 2

a < b == true;  

19. dotnet_style_require_accessibility_modifiers

Description: Enforces accessibility keywords on members.

Examples
When True

public void MyMethod() { }  

When False

void MyMethod() { }  

20. dotnet_style_coalesce_expression

Description: Prefers ?? operator over conditional expressions for null checks.

Examples
When True

var result = value ?? "default";  

When False

var result = value != null ? value : "default";  

21. dotnet_style_collection_initializer

Description: Enforces using collection initializers.

Examples
When True

var list = new List<int> { 1, 2, 3 };  

When False

var list = new List<int>();  
list.Add(1);  
list.Add(2);  
list.Add(3);  

22. dotnet_style_explicit_tuple_names

Description: Ensures tuple elements have explicit names.

Examples
When True

(int Id, string Name) person = (1, "John");  

When False

(int, string) person = (1, "John");  

23. dotnet_style_namespace_match_folder

Description: Enforces that namespaces match the folder structure.

Examples
When True

// File: MyProject/Utilities/Logger.cs  
namespace MyProject.Utilities;  

When False

// File: MyProject/Utilities/Logger.cs  
namespace SomeRandomName;  

24. dotnet_style_null_propagation

Description: Prefers ?. operator over explicit null checks.

Examples
When True

var length = str?.Length;  

When False

var length = str == null ? 0 : str.Length;  

25. dotnet_style_object_initializer

Description: Enforces using object initializers.

Examples
When True

var person = new Person { Name = "Alice", Age = 30 };  

When False

var person = new Person();  
person.Name = "Alice";  
person.Age = 30;  

26. dotnet_style_operator_placement_when_wrapping

Description: Sets operator placement when wrapping lines.

Examples
Option 1 (beginning_of_line):

var sum = a  
    + b  
    + c;  

Option 2 (end_of_line):

var sum = a +  
    b +  
    c;  

27. dotnet_style_prefer_auto_properties

Description: Prefers auto-properties over explicit backing fields.

Examples
When True

public int Age { get; set; }  

When False

private int _age;  
public int Age { get => _age; set => _age = value; }  

28. dotnet_style_prefer_collection_expression

Description: Prefers collection expressions (e.g., [1, 2, 3]).

Examples
Option 1

var list = [1, 2, 3];  

Option 2

var list = new List<int> { 1, 2, 3 };  

29. dotnet_style_prefer_compound_assignment

Description: Prefers compound assignment operators (e.g., +=).

Examples
When True

x += 1;  

When False

x = x + 1;  

30. dotnet_style_prefer_conditional_expression_over_assignment

Description: Prefers conditional expressions over if statements for assignments.

Examples
When True

var result = condition ? "Yes" : "No";  

When False

string result;  
if (condition) result = "Yes";  
else result = "No";  

31. dotnet_style_prefer_conditional_expression_over_return

Description: Prefers conditional expressions over if statements for returns.

Examples
When True

return condition ? "Yes" : "No";  

When False

if (condition) return "Yes";  
return "No";  

32. dotnet_style_prefer_foreach_explicit_cast_in_source

Description: Prefers explicit casting in foreach loops when types are known.

Examples
Option 1

foreach (string x in collectionOfObjects) { }  

Option 2

foreach (var x in collectionOfObjects.Cast<string>()) { }  

33. dotnet_style_prefer_inferred_anonymous_type_member_names

Description: Omits redundant property names in anonymous types.

Examples
When True

var anon = new { FirstName, LastName };  

When False

var anon = new { FirstName = FirstName, LastName = LastName };  

34. dotnet_style_prefer_inferred_tuple_names

Description: Omits redundant tuple element names.

Examples
When True

var person = (firstName, lastName);  

When False

var person = (firstName: firstName, lastName: lastName);  

35. dotnet_style_prefer_is_null_check_over_reference_equality_method

Description: Prefers is null over ReferenceEquals(obj, null).

Examples
When True

if (obj is null) { }  

When False

if (ReferenceEquals(obj, null)) { }  

36. dotnet_style_prefer_simplified_boolean_expressions

Description: Prefers simplified boolean expressions.

Examples
When True

if (flag) { }  

When False

if (flag == true) { }  

37. dotnet_style_prefer_simplified_interpolation

Description: Prefers simplified string interpolation.

Examples
When True

$"Hello {name}";  

When False

$"Hello {name.ToString()}";  

38. dotnet_style_readonly_field

Description: Enforces readonly for immutable fields.

Examples
When True

private readonly int _count = 0;  

When False

private int _count = 0;  

39. dotnet_code_quality_unused_parameters

Description: Configures how unused parameters are handled.

Examples
Option 1 (align with interface):

void IInterface.Method(int unused) { }  

Option 2 (warning):

void Method(int unused) { } // Warning  

40. dotnet_remove_unnecessary_suppression_exclusions

Description: Controls which suppressions are considered unnecessary.


41. dotnet_style_allow_multiple_blank_lines_experimental

Description: Controls whether multiple consecutive blank lines are allowed.


42. dotnet_style_allow_statement_immediately_after_block_experimental

Description: Controls whether statements can follow closing braces on the same line.

Examples
When True

if (condition)  
{  
    DoSomething();  
} DoSomethingElse();  

When False

if (condition)  
{  
    DoSomething();  
}  
DoSomethingElse();  

43. csharp_style_var_elsewhere

Description: Controls var usage for non-built-in types.

Examples
When True

int x = 0;  

When False

var x = 0;  

44. csharp_style_var_for_built_in_types

Description: Enforces var for built-in types.

Examples
When True

var x = 0;  

When False

int x = 0;  

45. csharp_style_var_when_type_is_apparent

Description: Enforces var when the type is obvious.

Examples
When True

var stream = new MemoryStream();  

When False

MemoryStream stream = new MemoryStream();  

46. csharp_style_expression_bodied_accessors

Description: Enforces expression-bodied syntax for property accessors.

Examples
When True

public int Age => _age;  

When False

public int Age { get { return _age; } }  

47. csharp_style_expression_bodied_constructors

Description: Enforces expression-bodied syntax for constructors.

Examples
When True

public Person() => Name = "Unknown";  

When False

public Person()  
{  
    Name = "Unknown";  
}  

48. csharp_style_expression_bodied_indexers

Description: Enforces expression-bodied syntax for indexers.

Examples
When True

public int this[int index] => _items[index];  

When False

public int this[int index]  
{  
    get { return _items[index]; }  
}  

49. csharp_style_expression_bodied_lambdas

Description: Enforces expression-bodied syntax for lambdas.

Examples
When True

var func = x => x * 2;  

When False

var func = x =>  
{  
    return x * 2;  
};  

50. csharp_style_expression_bodied_local_functions

Description: Enforces expression-bodied syntax for local functions.

Examples
When True

int Sum(int a, int b) => a + b;  

When False

int Sum(int a, int b)  
{  
    return a + b;  
}  

51. csharp_style_expression_bodied_methods

Description: Enforces expression-bodied syntax for methods.

Examples
When True

public int GetValue() => 42;  

When False

public int GetValue()  
{  
    return 42;  
}  

52. csharp_style_expression_bodied_operators

Description: Enforces expression-bodied syntax for operator overloads.

Examples
When True

public static Vector operator +(Vector a, Vector b) => new(a.X + b.X, a.Y + b.Y);  

When False

public static Vector operator +(Vector a, Vector b)  
{  
    return new Vector(a.X + b.X, a.Y + b.Y);  
}  

53. csharp_style_expression_bodied_properties

Description: Enforces expression-bodied syntax for properties.

Examples
When True

public int MyProperty => _myField;  

When False

public int MyProperty  
{  
    get { return _myField; }  
}  

54. csharp_style_pattern_matching_over_as_with_null_check

Description: Prefers pattern matching over as + null check.

Examples
When True

if (obj is MyClass c) { }  

When False

var c = obj as MyClass;  
if (c != null) { }  

55. csharp_style_pattern_matching_over_is_with_cast_check

Description: Prefers pattern matching over is + cast.

Examples
When True

if (obj is MyClass c) { /* ... */ }  

When False

if (obj is MyClass) { var c = (MyClass)obj; /* ... */ }  

56. csharp_style_prefer_extended_property_pattern

Description: Prefers extended property patterns (e.g., { Property: 10 }).

Examples
When True

if (obj is { Property: 10 }) { /* ... */ }  

When False

if (obj is MyClass { Property: 10 }) { /* ... */ }  

57. csharp_style_prefer_not_pattern

Description: Prefers not pattern over ! operator for negation.

Examples
When True

if (obj is not null) { /* ... */ }  

When False

if (!(obj is null)) { /* ... */ }  

58. csharp_style_prefer_pattern_matching

Description: Prefers pattern matching expressions overall when possible.

Examples
When True

if (obj is MyClass c) { /* ... */ }  

When False

if (obj is MyClass) { var c = (MyClass)obj; /* ... */ }  

59. csharp_style_prefer_switch_expression

Description: Prefers switch expressions over switch statements.

Examples
When True

return input switch { 1 => "one", 2 => "two", _ => "other" };  

When False

switch (input)  
{  
    case 1: return "one";  
    case 2: return "two";  
    default: return "other";  
}  

60. csharp_style_conditional_delegate_call

Description: Prefers ?.Invoke() syntax over explicit null checks for delegates.

Examples
When True

MyEvent?.Invoke(this, EventArgs.Empty);  

When False

if (MyEvent != null) { MyEvent(this, EventArgs.Empty); }  

61. csharp_prefer_static_anonymous_function

Description: Prefers static anonymous functions when they don’t capture outer variables.

Examples
When True

Func<int, int> sq = static x => x * x;  

When False

Func<int, int> sq = x => x * x;  

62. csharp_prefer_static_local_function

Description: Prefers static local functions when they don’t capture outer variables.

Examples
When True

static int Add(int a, int b) => a + b;  

When False

int Add(int a, int b) => a + b;  

63. csharp_preferred_modifier_order

Description: Enforces the order of modifiers (e.g., public static over static public).

Examples
Correct Order

public static int MyValue;  

Incorrect Order

static public int MyValue;  

64. csharp_style_prefer_readonly_struct

Description: Enforces readonly struct for immutable structs.

Examples
When True

public readonly struct MyStruct { /* ... */ }  

When False

public struct MyStruct { /* ... */ }  

65. csharp_style_prefer_readonly_struct_member

Description: Enforces readonly on struct members where possible.

Examples
When True

public readonly int GetValue() => _value;  

When False

public int GetValue() => _value;  

66. csharp_prefer_braces

Description: Enforces braces for control flow statements.

Examples
When True

if (condition)  
{  
    DoSomething();  
}  

When False

if (condition) DoSomething();  

67. csharp_prefer_simple_using_statement

Description: Enforces simplified using statements (C# 8+).

Examples
When True

using var file = new FileStream(...);  

When False

using (var file = new FileStream(...)) { /* ... */ }  

68. csharp_style_namespace_declarations

Description: Enforces file-scoped or block-scoped namespace declarations.

Examples
File-Scoped

namespace MyNamespace;  

Block-Scoped

namespace MyNamespace  
{  
    // ...  
}  

69. csharp_style_prefer_method_group_conversion

Description: Prefers method groups over lambda expressions when equivalent.

Examples
When True

list.ForEach(Console.WriteLine);  

When False

list.ForEach(x => Console.WriteLine(x));  

70. csharp_style_prefer_primary_constructors

Description: Prefers primary constructors for classes.

Examples
When True

public class Person(string name) { /* ... */ }  

When False

public class Person  
{  
    public Person(string name) { /* ... */ }  
}  

71. csharp_style_prefer_top_level_statements

Description: Prefers top-level statements over explicit Program class.

Examples
When True

Console.WriteLine("Hello, World!");  

When False

class Program  
{  
    static void Main()  
    {  
        Console.WriteLine("Hello, World!");  
    }  
}  

72. csharp_prefer_simple_default_expression

Description: Prefers default over default(T).

Examples
When True

var value = default;  

When False

var value = default(int);  

73. csharp_style_deconstructed_variable_declaration

Description: Prefers var (x, y) syntax for deconstruction.

Examples
When True

var (x, y) = GetValues();  

When False

(int x, int y) = GetValues();  

74. csharp_style_implicit_object_creation_when_type_is_apparent

Description: Prefers new() over explicit type when apparent.

Examples
When True

List<int> numbers = new();  

When False

List<int> numbers = new List<int>();  

75. csharp_style_inlined_variable_declaration

Description: Prefers inline variable declarations (e.g., out int x).

Examples
When True

if (int.TryParse(str, out int x)) { /* ... */ }  

When False

int x;  
if (int.TryParse(str, out x)) { /* ... */ }  

76. csharp_style_prefer_index_operator

Description: Prefers ^ operator for end-based indexing.

Examples
When True

var lastItem = array[^1];  

When False

var lastItem = array[array.Length - 1];  

77. csharp_style_prefer_local_over_anonymous_function

Description: Prefers local functions over anonymous lambdas.

Examples
When True

int Sum(int a, int b) => a + b;  

When False

Func<int, int, int> sum = (a, b) => a + b;  

78. csharp_style_prefer_null_check_over_type_check

Description: Prefers null checks over type checks (e.g., obj is null).

Examples
When True

if (obj is null) { /* ... */ }  

When False

if (!(obj is SomeType)) { /* ... */ }  

79. csharp_style_prefer_range_operator

Description: Prefers .. operator for slicing.

Examples
When True

var slice = array[1..3];  

When False

var slice = array.Skip(1).Take(2);  

80. csharp_style_prefer_tuple_swap

Description: Prefers tuple swap syntax (e.g., (x, y) = (y, x)).

Examples
When True

(x, y) = (y, x);  

When False

var temp = x;  
x = y;  
y = temp;  

81. csharp_style_prefer_utf8_string_literals

Description: Prefers u8 suffix for UTF-8 string literals.

Examples
When True

var bytes = "Hello"u8;  

When False

var bytes = Encoding.UTF8.GetBytes("Hello");  

82. csharp_style_throw_expression

Description: Prefers throw expressions over separate if checks.

Examples
When True

var person = value ?? throw new ArgumentNullException(nameof(value));  

When False

if (value == null) throw new ArgumentNullException(nameof(value));  

83. csharp_style_unused_value_assignment_preference

Description: Defines handling of unused assignments (e.g., _ = ...).

Examples
Option 1 (discard):

_ = SomeMethod();  

Option 2 (unused local):

var unused = SomeMethod();  

84. csharp_style_unused_value_expression_statement_preference

Description: Defines handling of unused expression statements.

Examples
Option 1 (discard):

_ = SomeMethod();  

Option 2 (remove):

SomeMethod();  

85. csharp_using_directive_placement

Description: Enforces placement of using directives (inside/outside namespace).

Examples
Outside Namespace

using System;  
namespace MyNamespace;  

Inside Namespace

namespace MyNamespace  
{  
    using System;  
}  

86. csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental

Description: Allows/disallows blank lines after : in constructor initializers.

Examples
When True

public MyClass() :  
    base() { }  

When False

public MyClass() : base() { }  

87. csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental

Description: Allows/disallows blank lines after => in expression-bodied members.

Examples
When True

public int GetValue() =>  
    42;  

When False

public int GetValue() => 42;  

88. csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental

Description: Allows/disallows blank lines after ?/: in ternary expressions.

Examples
When True

var result = condition ?  
    "Yes" :  
    "No";  

When False

var result = condition ? "Yes" : "No";  

89. csharp_style_allow_blank_lines_between_consecutive_braces_experimental

Description: Allows/disallows blank lines between consecutive braces.

Examples
When True

{  
    {  
    }  
}  

When False

{  
    {  
    }  
}  

90. csharp_style_allow_embedded_statements_on_same_line_experimental

Description: Allows/disallows embedded statements on the same line.

Examples
When True

if (x) { y++; }  

When False

if (x)  
{  
    y++;  
}  

91. csharp_new_line_before_catch

Description: Enforces new line before catch.

Examples
When True

try  
{  
}  
catch  
{  
}  

When False

try { } catch { }  

92. csharp_new_line_before_else

Description: Enforces new line before else.

Examples
When True

if (condition)  
{  
}  
else  
{  
}  

When False

if (condition) { } else { }  

93. csharp_new_line_before_finally

Description: Enforces new line before finally.

Examples
When True

try  
{  
}  
finally  
{  
}  

When False

try { } finally { }  

94. csharp_new_line_before_members_in_anonymous_types

Description: Enforces new lines between members in anonymous types.

Examples
When True

var anon = new  
{  
    Name = "Alice",  
    Age = 30  
};  

When False

var anon = new { Name = "Alice", Age = 30 };  

95. csharp_new_line_before_members_in_object_initializers

Description: Enforces new lines between members in object initializers.

Examples
When True

var person = new Person  
{  
    Name = "Bob",  
    Age = 20  
};  

When False

var person = new Person { Name = "Bob", Age = 20 };  

96. csharp_new_line_before_open_brace

Description: Enforces new line before opening braces.

Examples
When True

if (condition)  
{  
}  

When False

if (condition) {  
}  

97. csharp_new_line_between_query_expression_clauses

Description: Enforces new lines between query clauses.

Examples
When True

var result = from x in collection  
             where x > 0  
             select x;  

When False

var result = from x in collection where x > 0 select x;  

98. csharp_indent_block_contents

Description: Enforces indentation of block contents.

Examples
When True

{  
    statement;  
}  

When False

{  
statement;  
}  

99. csharp_indent_braces

Description: Controls whether braces are indented.

Examples
When True

if (condition)  
    {  
        statement;  
    }  

When False

if (condition)  
{  
    statement;  
}  

100. csharp_indent_case_contents

Description: Enforces indentation of case contents in switch.

Examples
When True

switch (value)  
{  
    case 1:  
        DoSomething();  
        break;  
}  

When False

switch (value)  
{  
case 1:  
    DoSomething();  
    break;  
}  

101. csharp_indent_case_contents_when_block

Description: Enforces indentation of case blocks with braces.

Examples
When True

case 1:  
{  
    DoSomething();  
    break;  
}  

When False

case 1:  
{  
DoSomething();  
break;  
}  

102. csharp_indent_labels

Description: Controls indentation level of labels.

Examples
Option 1 (one_less_than_current):

    labelName:  
        DoSomething();  

Option 2:

labelName:  
    DoSomething();  

103. csharp_indent_switch_labels

Description: Enforces indentation of switch labels (case, default).

Examples
When True

switch (value)  
{  
    case 1:  
        break;  
}  

When False

switch (value)  
{  
case 1:  
    break;  
}  

104. csharp_space_after_cast

Description: Controls spacing after cast operators.

Examples
When True

(int) x;  

When False

(int)x;  

105. csharp_space_after_colon_in_inheritance_clause

Description: Controls spacing after : in base class/interface list.

Examples
When True

class Derived : Base { }  

When False

class Derived :Base { }  

106. csharp_space_after_comma

Description: Controls spacing after commas.

Examples
When True

var tuple = (1, 2);  

When False

var tuple = (1,2);  

107. csharp_space_after_dot

Description: Controls spacing after a dot.

Examples
When True

obj. Property;  

When False

obj.Property;  

108. csharp_space_after_keywords_in_control_flow_statements

Description: Enforces spacing after keywords like if, for, while, etc.

Examples
When True

if (condition) { }  

When False

if(condition) { }  

109. csharp_space_after_semicolon_in_for_statement

Description: Enforces spacing after semicolons in for statements.

Examples
When True

for (int i = 0; i < 10; i++) { }  

When False

for (int i = 0;i < 10;i++) { }  

110. csharp_space_around_binary_operators

Description: Controls spacing around binary operators.

Examples
When True

a + b;  

When False

a+b;  

111. csharp_space_around_declaration_statements

Description: Controls spacing around declaration statements.

Examples
When True

int  x   =  0;  

When False

int x = 0;  

112. csharp_space_before_colon_in_inheritance_clause

Description: Controls spacing before : in base class/interface list.

Examples
When True

class Derived : Base { }  

When False

class Derived: Base { }  

113. csharp_space_before_comma

Description: Controls spacing before commas.

Examples
When True

var tuple = (1 , 2);  

When False

var tuple = (1, 2);  

114. csharp_space_before_dot

Description: Controls spacing before a dot.

Examples
When True

obj .Property;  

When False

obj.Property;  

115. csharp_space_before_open_square_brackets

Description: Controls spacing before [ in attributes or indexers.

Examples
When True

[ Obsolete]  

When False

[Obsolete]  

116. csharp_space_before_semicolon_in_for_statement

Description: Controls spacing before semicolons in for statements.

Examples
When True

for (int i = 0 ; i < 10 ; i++) { }  

When False

for (int i = 0; i < 10; i++) { }  

117. csharp_space_between_empty_square_brackets

Description: Controls spacing between empty brackets [].

Examples
When True

new int[ 0 ];  

When False

new int[0];  

118. csharp_space_between_method_call_empty_parameter_list_parentheses

Description: Controls spacing in empty parameter lists.

Examples
When True

Method( );  

When False

Method();  

119. csharp_space_between_method_call_name_and_opening_parenthesis

Description: Controls spacing between method name and (.

Examples
When True

Method (arg);  

When False

Method(arg);  

120. csharp_space_between_method_call_parameter_list_parentheses

Description: Controls spacing within parameter parentheses.

Examples
When True

Method(a, b);  

When False

Method(a,b);  

121. csharp_space_between_method_declaration_empty_parameter_list_parentheses

Description: Controls spacing in empty parameter lists for methods.

Examples
When True

void Method( );  

When False

void Method();  

122. csharp_space_between_method_declaration_name_and_open_parenthesis

Description: Controls spacing between method name and (.

Examples
When True

void Method (string x);  

When False

void Method(string x);  

123. csharp_space_between_method_declaration_parameter_list_parentheses

Description: Controls spacing within method parameter parentheses.

Examples
When True

void Method(int x, int y);  

When False

void Method(int x,int y);  

124. csharp_space_between_parentheses

Description: Controls spacing inside parentheses in expressions.

Examples
When True

( x + y );  

When False

(x + y);  

125. csharp_space_between_square_brackets

Description: Controls spacing inside square brackets.

Examples
When True

array[ 0 ];  

When False

array[0];  

126. csharp_preserve_single_line_blocks

Description: Controls whether single-line blocks are kept on one line.

Examples
When True

if (condition) { DoSomething(); }  

When False

if (condition)  
{  
    DoSomething();  
}  

127. csharp_preserve_single_line_statements

Description: Controls whether single-line statements remain on one line.

Examples
When True

if (condition) DoSomething();  

When False

if (condition)  
{  
    DoSomething();  
}  

128. dotnet_naming_rule.interface_should_be_begins_with_i

Description: Enforces interface names to start with I.

Examples
When True

public interface IMyInterface { }  

When False

public interface MyInterface { }  

129. dotnet_naming_rule.types_should_be_pascal_case

Description: Enforces PascalCase for types (class, struct, enum, interface).

Examples
When True

public class MyClass { }  

When False

public class myClass { }  

130. dotnet_naming_rule.non_field_members_should_be_pascal_case

Description: Enforces PascalCase for non-field members (properties, events, methods).

Examples
When True

public void MyMethod() { }  

When False

public void myMethod() { }  

131. trim_trailing_whitespace

Description: Enforces removing trailing whitespace at the end of lines.

Examples
When True

"Line with no trailing spaces"  

When False

"Line with trailing spaces   "  

132. dotnet_diagnostic.IDE0005.severity

Description: Configures severity for unnecessary usings (Roslyn analyzers).

Examples
When True

using System; // if actually needed  

When False

using System; // if not used  

133. dotnet_diagnostic.IDE1006.severity

Description: Configures severity for naming rule violations.


134. dotnet_diagnostic.CS8019.severity

Description: Configures severity for unnecessary usings (C# compiler).


135. dotnet_diagnostic.IDE0079.severity

Description: Configures severity for redundant suppression of diagnostics.


136. dotnet_diagnostic.IDE0130.severity

Description: Configures severity for inconsistent nameof usage.


137. dotnet_diagnostic.CS1591.severity

Description: Configures severity for missing XML comment warnings.


138. csharp_prefer_system_threading_lock

Description: Enforces using lock keyword over Monitor.Enter.

Examples
When True

lock (locker) { /* ... */ }  

When False

Monitor.Enter(locker); // manually