Theory:
1, first of all to understand, C # language can not be used independently, must be combined. NETFramework to consider together.
2. C # is only a development language in its own right, although it is used to generate. NET environment, but it is not in itself. NET part of the. NET supports some of the features that C # does not support. Instead, the C # language supports some of the features. NET also does not support (such as overloading of operators).
3. NETFramework core is the execution environment of the runtime, called the Common Language Runtime (CLR) or the. NET runtime, and code that runs under CLR control is called managed code.
4, before the CLR to run the written source code needs to be compiled, compiled into two stages:
(1): Compile source code (c#,vb,f#) into Microsoft intermediate language IL
(2): The CLR compiles IL into platform-specific code
Il intermediate language and Java bytecode sharing a concept: all low-level languages, using numeric code, not text code, and can be quickly converted to local machine code. This general syntax provides important advantages for code:
1, platform-Independent
This means that the same file that contains the bytecode directive can be placed on any platform. (. NET platform independence is currently only in the theoretical category, and is not fully implemented.) But it's already there. NET partial cross-platform implementations, such as mono projects, and the use of C # in Android and iOS via Xamarin
2. Performance improvement
For the time being compared with Java bytecode and IL, IL is always compiled on the fly, and Java bytecode is often interpreted, and the process of translating Java bytecode into internal executable code when running an application can result in a loss of performance.
3. Fast compiling and running speed
Il is an instant compile, also known as JIT compilation (just compile the call part of the code, compiled once, the resulting local executable stored, the next run will not have to compile again), this process is more efficient than the beginning to compile the entire application code. Another point is that the final part of the compilation process occurs at run time, and the JIT compiler knows exactly what processor the program is running on, and can use some of the features provided by the processor or some machine instructions to optimize the final executable code. Traditional compilers are compiled into local machine executable code prior to release, so code optimization cannot be done for a particular processor, which also explains why managed IL code executes as quickly as the local machine code.
Not to be continued ...
The first chapter:. NET Architecture