diff --git a/src/content/resources/language/c-sharp/coding-conventions.md b/src/content/resources/language/c-sharp/coding-conventions.md index 16b9f5b..b686486 100644 --- a/src/content/resources/language/c-sharp/coding-conventions.md +++ b/src/content/resources/language/c-sharp/coding-conventions.md @@ -104,6 +104,24 @@ public bool IsAvailable() - Add at least one blank line between method definitions and property definitions. - Use parentheses to make clauses in an expression apparent, as shown in the following code. +```cs +//Do: +string password = Console.ReadLine(); +if(password == "1234") +{ + Console.WriteLine("Correct password!"); +} + +//Don't: +string password = Console.ReadLine(); +if(password == "1234") { Console.WriteLine("Correct password!"); } + +if(password == "4321") +{ +Console.WriteLine("Correct password!"); +} +``` + ## Commenting conventions - Place the comment on a separate line, not at the end of a line of code. @@ -111,14 +129,6 @@ public bool IsAvailable() - End comment text with a period. - Insert one space between the comment delimiter (//) and the comment text, as shown in the following example -```cs -string password = Console.ReadLine(); -if(password == "1234") -{ - Console.WriteLine("Correct password!"); -} -``` - ```cs //Do: