First, the basic structure of the procedure
1. It is customary to start learning a new language from "Hello World".
2. C # source files typically have a. cs extension.
3. The start of the program uses a using directive to reference four namespaces.
4. Namespaces provide a way to organize C # programs and libraries using hierarchies.
5. Namespaces contain types and other namespaces.
6. If you use a using directive to reference a given namespace, you can
The type that is used as a member of the namespace is not qualified.
For example: System.Console.WriteLine can be replaced by Console.WriteLine.
7. The program declares a _01_helloworld namespace.
8. Programs declare a program class.
9. There is only one member of the program class, which is the method named Main.
The main method is declared with the static modifier.
11. The instance method can use the keyword this to refer to a specific enclosing object instance,
The operation of a static method does not need to refer to a specific object.
12. A static method named Main is the entry point for the program.
The C # language itself does not have a separate runtime, the System namespace, by default,
The Microsoft C # compiler automatically references the class library.
Second, the Assembly
1. The key concepts of the organization structure in C # are programs, namespaces, types, members, and assemblies.
2. C # programs consist of one or more source files. The declaration type in the program, the type contains the member,
and can be organized according to namespaces. Classes and interfaces are examples of types. Fields, Methods,
Properties and events are examples of members.
3. When compiling C # programs, they are physically packaged as assemblies. Assemblies typically have file
The extension. exe or. dll, depending on whether they implement the application or implement the library.
4. Assembly contains executable code in the form of intermediate language (intermediate Language, IL) directives
Symbolic information in the form of metadata and meta data. Before the assembly is executed. NET Common Language runtime
The just-in-time (JIT) compiler automatically converts IL code in an assembly to processor-specific code.
5. Because the assembly is a self-describing functional unit that contains both code and metadata,
Therefore, # include directives and header files are not required in C #. To use a specific in a C # program
The public types and members contained in the assembly can only be referenced when the program is compiled.
Third, comments
1. Two types of annotations are supported: single-line comments and delimited annotations.
2. The single-line comment continues at the end of the source line with a character//start.
3. The delimited comment begins with the character/* and ends with the character */(minus the middle space).
4. Delimited annotations can span multiple lines.
5. Annotations cannot be nested.
6. Character Sequences */* and */(remove intermediate spaces) do not have any special meanings in//annotations.
7. The character sequence//and/* does not have any special meaning in the delimited comment.
8. Comments are not processed within characters and characters.
Referencing namespaces using system;using system.collections.generic;using system.linq;using system.text;// Declaration namespace namespace _01_helloworld{ // declaration class class Program { /* The class has a member of the Main method. The * main method is the entrance to the program. * using the static keyword decoration means that it is a static method. */ Static void main (String[] args) { // output to the screen hello world! console.writeline ("hello world!"); // waiting for user input console.readkey (); } }}
This article is from the "Time is the truth of the Best friend" blog, please be sure to keep this source http://joycejm.blog.51cto.com/9781632/1618814
C # BASIC Programming--helloworld