Friday, August 16, 2013

C# - Syntax rules and documentation

Like every other programing language, when writing in C# we must follow some basic rules, otherwise the complier return syntax errors.
We have few basic rules that you must understand when you write your code:

Blocks { }
Every part in our code will need to be inside “{ Code }” , it’s relevant for all  types of values we can use  (Namespaces , classes , methods , delegates ,loops…..). It’s clear to see that “{” start your code and “}” will close your code.

End Line using “();”
Every command you write should end with “();”, till now you can understand that your code must be combination of the last 2 rules:
Class A
First code line ();
Second code line ();

You can feel free to write your code without thinking about spaces, the compiler know is job an ignore unnecessary spaces.

Case Sensitive
You must pay attention for case sensitive issues because this Lang’ IS case sensitive, for example:
Variable A is different from Variable a  

Adding comments
In most cases you probably going to work on other developer code, therefore comments should be added in specific parts of code to save time and explain the code goals. Every part in your code that marked as comment will be visible but the compiler will ignore it.
“//” – mark single line as comment

/*your code*\ - mark multiple code parts as comments. 

No comments:

Post a Comment

My Presentations