Browse Source

Merge pull request #9164 from paulloz/dotnet/space-in-single-line-initializers

Update C# style guide (spaces in single line initializers)
Max Hilbrunner 1 year ago
parent
commit
2227328e5b
1 changed files with 2 additions and 2 deletions
  1. 2 2
      tutorials/scripting/c_sharp/c_sharp_style_guide.rst

+ 2 - 2
tutorials/scripting/c_sharp/c_sharp_style_guide.rst

@@ -154,11 +154,11 @@ Insert a space:
 * Around a colon in a type declaration.
 * Around a colon in a type declaration.
 * Around a lambda arrow.
 * Around a lambda arrow.
 * After a single-line comment symbol (``//``), and before it if used at the end of a line.
 * After a single-line comment symbol (``//``), and before it if used at the end of a line.
+* After the opening brace, and before the closing brace in a single line initializer.
 
 
 Do not use a space:
 Do not use a space:
 
 
 * After type cast parentheses.
 * After type cast parentheses.
-* Within single line initializer braces.
 
 
 The following example shows a proper use of spaces, according to some of the above mentioned conventions:
 The following example shows a proper use of spaces, according to some of the above mentioned conventions:
 
 
@@ -175,7 +175,7 @@ The following example shows a proper use of spaces, according to some of the abo
 
 
         public void MyMethod()
         public void MyMethod()
         {
         {
-            int[] values = {1, 2, 3, 4}; // No space within initializer brackets.
+            int[] values = { 1, 2, 3, 4 };
             int sum = 0;
             int sum = 0;
 
 
             // Single line comment.
             // Single line comment.