Datasheet

Chapter 1: Introducing C#
7
C#application
code
AssemblyCompilation
Figure 1-2
2. That code is compiled into MSIL, which is stored in an assembly (see Figure 1 - 2 ).
3. When this code is executed (either in its own right if it is an executable or when it is used from
other code), it must first be compiled into native code using a JIT compiler (see Figure 1 - 3 ).
Assembly
Native Code
JIT Compilation
Figure 1-3
4. The native code is executed in the context of the managed CLR, along with any other running
applications or processes, as shown in Figure 1 - 4 .
Native Code
.NET CLR
System Runtime
Native Code Native Code
Figure 1-4
Linking
Note one additional point concerning this process. The C# code that compiles into MSIL in step 2 needn t
be contained in a single file. It s possible to split application code across multiple source code files, which
are then compiled together into a single assembly. This extremely useful process is known as linking . This
is because it is far easier to work with several smaller files than one enormous one. You can separate out
logically related code into an individual file so that it can be worked on independently and then
CH001.indd 7CH001.indd 7 10/22/10 3:43:51 PM10/22/10 3:43:51 PM