Skip to content

Commit 3b7af67

Browse files
Cosmetic changes.
1 parent 3a6092c commit 3b7af67

File tree

8 files changed

+183
-185
lines changed

8 files changed

+183
-185
lines changed

.editorconfig

Lines changed: 57 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# Remove the line below if you want to inherit .editorconfig settings from higher directories
2-
root = true
3-
41
# C# files
52
[*.cs]
63

@@ -23,40 +20,40 @@ dotnet_sort_system_directives_first = false
2320
file_header_template = unset
2421

2522
# this. and Me. preferences
26-
dotnet_style_qualification_for_event = false
23+
dotnet_style_qualification_for_event = false:suggestion
2724
dotnet_style_qualification_for_field = false
28-
dotnet_style_qualification_for_method = false
29-
dotnet_style_qualification_for_property = false
25+
dotnet_style_qualification_for_method = false:suggestion
26+
dotnet_style_qualification_for_property = false:suggestion
3027

3128
# Language keywords vs BCL types preferences
32-
dotnet_style_predefined_type_for_locals_parameters_members = true
33-
dotnet_style_predefined_type_for_member_access = true
29+
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
30+
dotnet_style_predefined_type_for_member_access = true:warning
3431

3532
# Parentheses preferences
36-
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary
37-
dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary
38-
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
39-
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
33+
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:suggestion
34+
dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary:suggestion
35+
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion
36+
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion
4037

4138
# Modifier preferences
4239
dotnet_style_require_accessibility_modifiers = for_non_interface_members
4340

4441
# Expression-level preferences
45-
dotnet_style_coalesce_expression = true
42+
dotnet_style_coalesce_expression = true:warning
4643
dotnet_style_collection_initializer = true
4744
dotnet_style_explicit_tuple_names = true
4845
dotnet_style_namespace_match_folder = true
49-
dotnet_style_null_propagation = true
46+
dotnet_style_null_propagation = true:warning
5047
dotnet_style_object_initializer = true
5148
dotnet_style_operator_placement_when_wrapping = beginning_of_line
52-
dotnet_style_prefer_auto_properties = true
49+
dotnet_style_prefer_auto_properties = true:suggestion
5350
dotnet_style_prefer_compound_assignment = true
54-
dotnet_style_prefer_conditional_expression_over_assignment = true
55-
dotnet_style_prefer_conditional_expression_over_return = true
51+
dotnet_style_prefer_conditional_expression_over_assignment = true:warning
52+
dotnet_style_prefer_conditional_expression_over_return = true:warning
5653
dotnet_style_prefer_inferred_anonymous_type_member_names = true
5754
dotnet_style_prefer_inferred_tuple_names = true
58-
dotnet_style_prefer_is_null_check_over_reference_equality_method = true
59-
dotnet_style_prefer_simplified_boolean_expressions = true
55+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
56+
dotnet_style_prefer_simplified_boolean_expressions = true:warning
6057
dotnet_style_prefer_simplified_interpolation = true
6158

6259
# Field preferences
@@ -70,62 +67,62 @@ dotnet_remove_unnecessary_suppression_exclusions = none
7067

7168
# New line preferences
7269
dotnet_style_allow_multiple_blank_lines_experimental = true
73-
dotnet_style_allow_statement_immediately_after_block_experimental = true
70+
dotnet_style_allow_statement_immediately_after_block_experimental = false
7471

7572
#### C# Coding Conventions ####
7673

7774
# var preferences
78-
csharp_style_var_elsewhere = true
79-
csharp_style_var_for_built_in_types = true
80-
csharp_style_var_when_type_is_apparent = true
75+
csharp_style_var_elsewhere = false
76+
csharp_style_var_for_built_in_types = false
77+
csharp_style_var_when_type_is_apparent = true:suggestion
8178

8279
# Expression-bodied members
83-
csharp_style_expression_bodied_accessors = true
84-
csharp_style_expression_bodied_constructors = when_on_single_line
85-
csharp_style_expression_bodied_indexers = true
86-
csharp_style_expression_bodied_lambdas = true
87-
csharp_style_expression_bodied_local_functions = true
88-
csharp_style_expression_bodied_methods = true
89-
csharp_style_expression_bodied_operators = when_on_single_line
90-
csharp_style_expression_bodied_properties = true
80+
csharp_style_expression_bodied_accessors = true:suggestion
81+
csharp_style_expression_bodied_constructors = when_on_single_line:silent
82+
csharp_style_expression_bodied_indexers = true:suggestion
83+
csharp_style_expression_bodied_lambdas = true:suggestion
84+
csharp_style_expression_bodied_local_functions = true:suggestion
85+
csharp_style_expression_bodied_methods = true:suggestion
86+
csharp_style_expression_bodied_operators = true:suggestion
87+
csharp_style_expression_bodied_properties = true:suggestion
9188

9289
# Pattern matching preferences
93-
csharp_style_pattern_matching_over_as_with_null_check = true
94-
csharp_style_pattern_matching_over_is_with_cast_check = true
95-
csharp_style_prefer_not_pattern = true
96-
csharp_style_prefer_pattern_matching = true
90+
csharp_style_pattern_matching_over_as_with_null_check = true:warning
91+
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
92+
csharp_style_prefer_not_pattern = true:warning
93+
csharp_style_prefer_pattern_matching = true:suggestion
9794
csharp_style_prefer_switch_expression = true
9895

9996
# Null-checking preferences
100-
csharp_style_conditional_delegate_call = true
97+
csharp_style_conditional_delegate_call = true:warning
10198

10299
# Modifier preferences
103100
csharp_prefer_static_local_function = true
104101
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
105102

106103
# Code-block preferences
107-
csharp_prefer_braces = when_multiline
108-
csharp_prefer_simple_using_statement = true
109-
csharp_style_namespace_declarations = file_scoped
104+
csharp_prefer_braces = when_multiline:silent
105+
csharp_prefer_simple_using_statement = true:suggestion
106+
csharp_style_namespace_declarations = file_scoped:suggestion
110107

111108
# Expression-level preferences
112109
csharp_prefer_simple_default_expression = true
113110
csharp_style_deconstructed_variable_declaration = true
114111
csharp_style_implicit_object_creation_when_type_is_apparent = true
115112
csharp_style_inlined_variable_declaration = true
116113
csharp_style_pattern_local_over_anonymous_function = true
117-
csharp_style_prefer_index_operator = true
118-
csharp_style_prefer_null_check_over_type_check = true
119-
csharp_style_prefer_range_operator = true
120-
csharp_style_throw_expression = true
114+
csharp_style_prefer_index_operator = true:silent
115+
csharp_style_prefer_null_check_over_type_check = true:warning
116+
csharp_style_prefer_range_operator = true:silent
117+
csharp_style_throw_expression = true:warning
121118
csharp_style_unused_value_assignment_preference = discard_variable
122119
csharp_style_unused_value_expression_statement_preference = discard_variable
123120

124121
# 'using' directive preferences
125-
csharp_using_directive_placement = outside_namespace
122+
csharp_using_directive_placement = outside_namespace:warning
126123

127124
# New line preferences
128-
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
125+
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false:warning
129126
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true
130127
csharp_style_allow_embedded_statements_on_same_line_experimental = true
131128

@@ -217,3 +214,18 @@ dotnet_naming_style.begins_with_i.required_prefix = I
217214
dotnet_naming_style.begins_with_i.required_suffix =
218215
dotnet_naming_style.begins_with_i.word_separator =
219216
dotnet_naming_style.begins_with_i.capitalization = pascal_case
217+
csharp_style_prefer_extended_property_pattern = true:suggestion
218+
219+
[*.{cs,vb}]
220+
dotnet_style_operator_placement_when_wrapping = beginning_of_line
221+
tab_width = 4
222+
indent_size = 4
223+
end_of_line = crlf
224+
dotnet_style_coalesce_expression = true:warning
225+
dotnet_style_null_propagation = true:warning
226+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
227+
dotnet_style_prefer_auto_properties = true:suggestion
228+
dotnet_style_qualification_for_property = false:suggestion
229+
230+
# RCS1123: Add parentheses when necessary.
231+
dotnet_diagnostic.RCS1123.severity = silent

Lock.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
namespace Open.Threading;
55

66
/// <summary>
7-
/// A simple lock class for allowing for a timeout. If no timeout is desired, then simply use the lock(){} statement.
8-
///
9-
/// Example:
7+
/// <para>A simple lock class for allowing for a timeout. If no timeout is desired, then simply use the lock(){} statement.</para>
8+
/// <para>Example:</para>
109
/// <code>
1110
/// using(new Lock(sync,1000)) // If the timeout expires an exception is thrown.
1211
/// {
@@ -33,9 +32,10 @@ public Lock(object target, int millisecondsTimeout, bool throwIfTimeout = true)
3332
: base(target, Monitor.TryEnter(target, millisecondsTimeout))
3433
{
3534
if (!LockHeld && throwIfTimeout)
35+
{
3636
throw new TimeoutException(
3737
$"Could not acquire a lock within the timeout specified. (millisecondsTimeout={millisecondsTimeout})");
38-
38+
}
3939
}
4040

4141
protected override void OnDispose(object? target)

Open.Threading.ReadWrite.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</PropertyGroup>
2929

3030
<ItemGroup>
31-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
31+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
3232
</ItemGroup>
3333

3434
<ItemGroup>

ReadLock.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
namespace Open.Threading;
44

55
/// <summary>
6+
/// <para>
67
/// A simple read-only locking class which also allows for a timeout.
78
/// Extensions are available for use with a ReaderWriterLockSlim.
8-
///
9-
/// Example:
9+
/// </para>
10+
/// <para>Example:</para>
1011
/// <code>
1112
/// using(readWriteLockSlimInstance.ReadLock())
1213
/// {

0 commit comments

Comments
 (0)