mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-07 23:43:57 +02:00
Fixed layout conventions code example
This commit is contained in:
@@ -104,6 +104,24 @@ public bool IsAvailable()
|
|||||||
- Add at least one blank line between method definitions and property definitions.
|
- 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.
|
- 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
|
## Commenting conventions
|
||||||
|
|
||||||
- Place the comment on a separate line, not at the end of a line of code.
|
- 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.
|
- End comment text with a period.
|
||||||
- Insert one space between the comment delimiter (//) and the comment text, as shown in the following example
|
- 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
|
```cs
|
||||||
//Do:
|
//Do:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user