& Basic theory] C # basic syntax

C # code look and feel of C ++ and Java are very similar.


C # code compiler does not consider spaces, tabs, or carriage returns (these characters are collectively referred to as a blank character). So there is a lot of freedom when formatting codes, but to follow certain rules will help to improve the readability of the code.
C # code consists of a series of statements, each statement with a semicolon. Because the blank is ignored, so that a line can be more than one statement, but readability standpoint, usually coupled with a carriage return (i.e., a separate line for each line of code) after the division number well, not a line placed multiple statements.
C # is a block language structure, all statements are part of the code block. The blocks defined with braces ( "{}"). Code block can contain any number of rows statements include statements or not. Note that the characters do not need to brace comes with a semicolon. E.g:

Each block of code is a scope, a scope is the same code method name and parameters can not be repeated.


C # code, there is a common statement as comments on the code is not in the strict sense, but the code is best annotated (in favor of readability). That comment is descriptive text code can be any word in any language, the compiler will automatically ignores comments during compilation. Begin // use single-line comments, the comment block (multi-line comments) using / * * / FIG. E.g:

Guess you like

Origin www.cnblogs.com/gme5/p/11797313.html