One. NET history
1.. The History of Net
Web--HTML--asp/asp.net--ASPX--. NET
DOS black screen static page dynamic page--Unlimited expansion of database ASP 2002
2.. NET software updates
Second, C # programming
1. Project structure
. cs--program code files, source files
. config--configuration file
. csproj--project file (used to manage file entries)
. sln--solution files (for managing projects)
PS: After the selection is removed, only the item is removed, and the item still exists in the file.
2. Functions
Definition: Ability to perform a function independently
Four elements: 1) Name 2) input 3) output 4) processing
Main function: static void Main (string [] args)
{
}
Input statement:
string s = Console.ReadLine ();
Output statement:
Console.WriteLine ("What to Output");(display content wrapping, cursor on second line)
Console.Write ("What to Output");(display does not wrap, the cursor is behind the input)
Ps:main "M" must be uppercase, statement ends with ";".
Shortcut keys:
Delete entire line: Shift+del
Check change to comment: Ctrl+k+c Cancel: Ctrl+k+u
(Note: "//", "*/*".)
AutoCorrect for Words: ALT + "→" (rightwards Arrow)
3. Data type
1) integral type: int short long byte
2) Float type: float double decimal
3) Character type: Char
4) Boolean type: BOOL
5) string-type: string
6) DateTime Date/Time type
Ps:char with "display content, string with" "" display content; Common data type: Int (integer), double (floating point type).
4. Variables
1) Naming rules for variables:
A. Consists of letters, numbers, underscores, symbols @, Chinese characters.
B. The first character cannot be a number.
C. The name cannot be the same as the System keyword.
Example: an illegal identifier
a.2x--first letter cannot be a number
b.class--and System "class" duplicate name
c.c#+variable--"#" "+" for illegal symbols
2) Definition of variables
Data type variable name [= value];
int a = 10;
3) Use of variables: assignment, value
A = 90;
A = a + 100;
The floating-point type defaults to double, and if you want to use float, you can use the "F" suffix.
Example: Fioat a=8.2f
5. Constants
1) Classification:
A. Symbolic constants: replacing values with symbols
B. Literal constants: The value to the right of "="
2) Definition of Symbolic constants: Add "const" before variable definition
Example: const BOOL D=true
3) Use of symbolic constants: cannot be assigned, only values can be taken.
4) Escape character
' \a '--sound
' \ t '--tab key character
' \ \ '--backslash-appears as ' \ '
' \ '--single quote
' \ '--double quotes
' \ n '--wrap
' \ R '--Enter
Example: Console.WriteLine ("Zhang San said: \" Are you a person? ")
Show as Zhang San said: "Are you a person?"