1. Net
Technology platform to create interoperable applications
2 applications
Embedded development
Enterprise-Class applications
3. NET Framework
Technology:
Common Language runtime
Working mode of the. NET Framework:
. netc#> Compiler msil>clr> Execution
. NET class library (FCL)
4 First C # program
Using System; referencing namespaces, working with classes in namespaces
Namespaces: A way to organize your code.
System: Common namespaces
Console class
Cases:
Using System
Namespace _01
{
Class Hello
{
static void Main (string[] args)
{
Console.WriteLine ("Hello World");
Console.readkey ();
}
}
}
Modifier + Return value + method name (parameter list)
{
Method body
}
Main method: Portal of the application
static void Main () {}
static void Main (string []args) {}
File extension XXX.cs
5 VS
Keywords (reserved words)
Namespace namespace//define Namespace
{
}
Note: Compiler ignores
Role: Improve code readability
Single-line Comment: From//start to the end of the bank as the comment content
/**/Multiline Comment: All content is commented from/* to * *
vs Common techniques:
Window Hide Display
IntelliSense function alt+>
Red wavy line underline identifies syntax error
Green wavy line underline flag warning
F1 Help
F12 to open meta data
F5 start Debug execution, successful failure results
How to convert line numbers based on error information
Method in the class, the statement in the method
{} () must appear in pairs
If it is more correct, the code format will not be messy; If the code format is confusing, you need to stop modifying the error
6 the Console class can be implemented
Reading a single character or whole line
Output character or entire line
Set window foreground or background color
Set the position of the cursor
Example:
Set the window size, set the window size exponentially fixed value
Console.setwindowsize (80, 30);
Setting the screen's buffer cannot be less than the actual window size
Console.setbuffersize (100, 80);
Set Window Caption
Console.title = "Book Management system";
Set cursor position
Console.setcursorposition (34, 1);
Set the color of the content
Console.foregroundcolor = Consolecolor.green;
Console.WriteLine ("Book Management System");
Console.foregroundcolor = consolecolor.red;
Input/Output
Console.WriteLine ("Please enter your name");
String i = Console.ReadLine ();
Console.WriteLine ("Your name is" +i);
Console.WriteLine ("Enter any key to continue");
Console.readkey ();
Emptying the console screen
Console.clear ();
Console.readkey ();
7 Common escape characters
\ nthe line break
Console.WriteLine ("Zhang San \n18");
\ t Auto Align
Console.WriteLine ("Zhang San \t18");
Console.WriteLine ("Zhang San \t18");
\ \ output a \
\ "Outputs a double quotation mark
Summarize:
. NET
Embedded PC Enterprise Mobile
. Framworl CLR and FCL
Compiling and running programs
DOS command
Ide
Use of VS2010
Solution Solutions
Project
Class
(see project for specific code)
Attention:
Nesting, indenting
In pairs appear () {} "" '
Strictly case-sensitive
. NET Environment Development variables