1.. NET Overview and C # applications
C # is specifically designed for. NET platform to design a language.
The designer is: Anders Hejlerg is also a founder of Pascal and Delphi language.
2.IDE Environment
Development environment: Visual Studio
3. Creation of the first C # program
4. Understanding the structure of the console application folder
1) Program.cs: The file is located in the startup file that defines the project's startup entry, which is the main () method.
2) HelloWorld.exe: This file is located in the Bin\dedug directory, is the project compiled after the production of executable files, you can run directly.
Analyze the following code:
Using system;using system.collections.generic;using system.linq;using system.text;namespace HelloWorld{ class program{ static void Main (string[] args) { Console.WriteLine ("HelloWorld"); Console.ReadLine ();}}}
1.namespace keywords
Is the way you organize your code in C #, which works like a package in Java.
2.using keywords
Apply a different namespace, similar to import in Java.
3.class keywords
Like Java, C # is an object-oriented language that uses the class keyword to represent a class and does not require the class name to be the same as the source file.
4.Main () method
As with Java, it is the entrance to the program.
5. Keyword Code
The last two lines.
Variables and constants for 5.c#
1:) C # variables are the same as in Java
Syntax: data type variable name;
The naming convention is basically the same as Java, and only the $ symbol is not available.
2:) constant
Syntax: const data type constant name = value;
const int daymax=7;
Naming conventions for constants
1) The constant name must have some practical meaning.
2) The name of the constant is best to be named in uppercase letters, the middle can be used to connect the glide line, preferably on the right side of the comment.
3) The name length should not exceed 25 characters.
6.Console class
1) Output from console
Three Middle Way:
Console.WriteLine ();
Console.WriteLine (the value to output);
2) read in from the console
Console.ReadLine ();
7. Classes and objects
Almost like Java.
8. Notes
Line comments and block comments are the same as in Java, where the document comments are different, using "///".
Console.wirteline ("format string", variable list);
The first C # program