Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Text;
Using System.Threading.Tasks;
Namespace ConsoleApplication1
{
Class Program
{
Main is the entry of the program, the main function
static void Main (string[] args)
{
Output
Console.Write ("This is my first program!") ");
Console.WriteLine ("This is my second line of code! ");
Console console command
Input
string defines a type
There must be parentheses behind the method
AutoComplete Word function ALT + RIGHT CURSOR key
Console.WriteLine ("Please enter what you want to enter:");
Receive all characters before you receive the Enter command directly
An equal sign means that the copy is good
string s = Console.ReadLine ();//Enter before entering the carriage
The plus sign then encounters the string type as a concatenation action.
Console.WriteLine ("The content you just entered is:" +s);
Case: Enter name, age, work unit, integrate into a sentence fluent expression
Console.Write ("Please enter Name:");
String name = Console.ReadLine ();
Console.Write ("Please enter Age:");
String age = Console.ReadLine ();
Console.Write ("Please enter work unit:");
String Danwei = Console.ReadLine ();
Console.WriteLine ("I Call" +name+ ", this year" +age+ ", I" +danwei+ "work");
Console.ReadLine ();
}
}
}
The class class using represents the library referenced by the program, the following system, and so on, represented as consoles these libraries are provided by the. NETFramework static void Main (string[] args) is a method string[] is a nested array of main master routines Sequence, program entry, Priority execution namespace namespace
Console is the console command read input, write output, after adding line for word wrap, Alt + right to AutoComplete words, ctrl+f5 start execution,(red Word for actual operation and handout, or the teacher did not speak in the handout) Ctrl+e, Then press CTRL + C to annotate the bank, Ctrl+e, and then press Ctrl+u to uncomment the line; Shift+delete delete a row; ctrl+x cut one line; Ctrl+shift+space place the cursor in the method function bracket is used, display overloaded ; Comment one line;/* Comment out the middle content */; Separate multiple variables that declare the same class in a row, such as int A, B, (declare the variable type, separated by commas); In the same statement, you cannot declare the same variable name to the same type two times, for example: int a=34;int a=22; (error);
C # Second Lesson