Following syntax consistency guidelines
While syntax is something that we can’t avoid in any language, there are options for organizing it so that it’s much clearer to understand. As code bases get more complex and go through multiple changes, such as refactors or more features, understanding how they all work can get more complex. Just like naming, following a consistent layout for syntax can make complex code easier to read and maintain.
Organizing lines of code
You have most likely learned that every C# statement needs to end in a semicolon, or else it will not execute. However, did you know that you can have two statements on one line, like in the following example?
int myFirstNumber; int mySecondNumber;
This is valid syntax in C#, because the two statements are separated by a semicolon, but is it clear? Someone could certainly miss that there are two variables here. It’s best to put all complete statements, which are lines that end with a semicolon...