The.NET framework

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

This is a book on the.NET technology books, target readership is in the framework of.NET (.NET Framework) under development programmers, so we can't avoid the question: what is the.NET framework? It contains what content? Which provided the support for the development process? A lot of friends to this kind of question's first reaction may be large class library provided by the.NET framework and write code using C# language, far more than that.

To describe the.NET framework, will encounter a series of technical terms and abbreviations related professional, I believe that everyone has seen many, such as: CLI, CIL, CTS, CLS, CLR, JIT, BCL, FCL, Module, Assembly, enough to make many people confused, flinch. I don't like the dictionary as in alphabetical order by interpretation of terms, because it is difficult to understand. We start from the familiar things.!

6.1 introduction

Imagine this: write a simple display “ Hello, World! ” the console program, and what steps need the program to run?

using System;


class Program {

static void Main(string[] args) {

string text = "hello, world!";

Console.WriteLine(text);

}

}

These steps include: open Visual Studio, create a C# console application project (here named ConsoleApp), write code, compile the program and then run. Although this program who can write, but more thinking will find that, although is a small program, but has introduced several important aspects of the.NET framework.

If you create a VB.NET type projects, implementation and above C# project exactly the same function, then what is the difference between the compiler generated files?

Write a console application, the character of output to the screen, call Console.WriteLine () method. The Console type where it came from.?

The generated files in the system is how to operate? The mechanism and the use of traditional VC++ to generate the executable file are the same?

In fact, the above answer for each question are provided by the.NET framework support, here it is divided into three parts:

Then in view of the above contents we describe in detail.

6.2 CIL——Common intermediate language

First to know is C# program source code will get a file what after compilation. As we all know, the past is created using the VC++ executable file, after pre compiler, compiler, assembler, linking several steps, the resulting executable file already contains the processor's local code (Native, Code) support just set machine instructions and the operating system of its operation. Then using the C# compiler generated file is what? Now need to introduce the concept of the assembly: under the framework of.NET, similar to the C# language that after the compiler generates a result file is called assembly, the suffix is.Dll (Library) or.Exe (executable program). Before the introduction of the concept, the front (a) mentioned assemblies, are using “ &rdquo file; the word to describe the.

Define the assembly is to compile the files generated an a little bit more formal name, to explain the “ what it is made of ” the problem and not much help. In order to further understand the assembly, we'll do an experiment, create a console application project using the VB.NET (ConsoleAppVB), and generates an assembly, the code function and above with C# created project is the same.

Module Program

Sub Main()

Dim text AsString = "hello, world !"

Console.WriteLine(text)

EndSub

EndModule

Now, the need for a tool to view the program content, and generates a project with C# assembly compared. Fortunately, Microsoft has provided a tool for — — IL DASM (IL Disassembler, IL disassembler) to help developers to view the assembly information. If you have installed the Visual Studio, IL DASM will be installed along with the Visual Studio. Select Start menu → Microsoft Visual Studio 2010 → Microsoft Windows SDK Tools → IL disassembler (IL DASM) can start IL DASM.

Open the IL DASM VB.NET project to build the ConsoleAppVB.exe, can be seen as shown in Figure 6-1 interface.

Figure 6-1 IL DASM operation interface

This part of the contents of many, will &ldquo in the next chapter; assembly ” is devoted, here, skip. Diagram ConsoleAppVB.Program types in 6-1, in the Main () method on double click, will open another window, shown in Figure 6-2 code, it looks a bit like assembly language. Here you can see the familiar string text variable declarations and“hello, world !”.

Figure 6-2 the CIL language to describe the method body(VB.NET)

Then open the C# project to build the ConsoleApp.exe, performs the same operation, in the open Main () method will find the code and the 6-2 almost exactly the same, as shown in Figure 6-3

Figure 6-3 the CIL language to describe the method body(C#)

At this point, we can get a preliminary inference: either VB.NET or C#, the compiled assemblies can be opened in IL DASM, so they generated assembly format is the same; when the program function is the same, the assembly contains CIL code is similar.

A similar compilation of the above procedure now contains language is introduced, which is the title of this section in the CIL (Common Intermediate Language, common intermediate language). CIL was initially with the release of.NET by Microsoft, so it is also called the MSIL (the Microsoft before Intermediate Language), and later was standardized, then called CIL. In some book or article, CIL also known as IL, in fact, it is the same thing. To avoid confusion, book with the initials CIL.

We can put the above process shown in Figure 6-4.

Figure 6-4 source program is compiled to assembly

Then in-depth analysis, common intermediate language this term really contain what meaning.

In order to deepen the impression, we do a test: write a simple CIL code, and compile it using the IL ASM tool, be like before ConsoleApp.exe program.

1)Open Notepad program, enter the following code, which is then stored in the D:\ConsoleApp.il.

.assembly extern mscorlib{}

.assembly ConsoleApp{}

.module ConsoleApp.exe

.class public auto ansi Program extends System.Object

{

.method public static void Main()

{

.entrypoint

nop

ldstr "Hello, World!"

call void [mscorlib]System.Console::WriteLine(string)

nop

ret

}

}

2)Open the Visual Studio 2010 command line tool, input:

D:\>ilasm ConsoleApp.il

3)After the success will see ConsoleApp.exe program, its execution results and above C# prepared by the same.

Because the assembly is described by the CIL language, so CIL is also called the assembly language (Assembly Language). And because the.NET assembly is required by the.NET runtime loading can run, can be managed by the.NET as the operation, so that CIL code is also known as managed code (Managed Code). In contrast, does not require the.NET operation can be performed on the code is called unmanaged code(Unmanaged Code).

Well, already know the existence of CIL, from now on, the best established two models or two perspectives in mind: one is the C# or other programming language based on the perspective of the source code, is a CIL intermediate language program based on the set angle. C# source code is compiled into assemblies in the future, it is independent of the C#, so the assembly can be invoked by other kind of language; at the same time, because the assembly does not contain native machine instructions, so it is with the specific machine types are separated, any operation of the machine can be equipped with.NET frame.

6.3 BCL and FCL

6.3.1 BCL——The base class library

We first see an interesting phenomenon: open the front to create the C# console project again (ConsoleApp), and then open the &ldquo solution for the panel; reference ” folder, if you are using Visual Studio 2010, and target oriented framework is.NET version 4, you will see as shown in Figure 6-5. These references.

Figure 6-5 solutions in the &ldquo &rdquo folder; reference;

Any additional operation did not do when you create a project, then these references is automatically added when you create a project. In order to facilitate the beginners, here a little explanation: to use (in fact, I think that the word Consume is more appropriate) other types of developers in the project design, we need the type of assembly references. Now see the assembly references, Microsoft that are very common, almost every project will be used to, so when you create a project to automatically add in, so developers to manually add.

But here these references do not help us understand some of the content, so we put these references are deleted, as shown in Figure 6-6, then compile the program again.

Figure 6-6 delete all project references

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;


namespace ConsoleApp {

classProgram {

staticvoid Main(string[] args) {

string text = "Hello, world!";

Console.WriteLine(text);

}

}

}

Some people might think, to delete these references, the compiler will not hesitate to suggest a compilation error: could not find the type or namespace “ System” (whether the lack of using instructions or assembly references?). In fact, when you compile and run the code above, the program will execute correctly. This is because we have deleted all referenced assemblies, only the definition of a Program type, and Console type is not defined, the first question I have to face is: Console type comes from where?

Visual Studio provides a quick way to enable us to quickly view types: position the cursor on the Console, and then press F12 on the keyboard, you can see the type definition Console. At the top of the Console type is defined, you can see it in the assembly.: C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll.

#Region assembly mscorlib.dll, v4.0.30319

// C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll

#endregion

using System.IO;

using System.Runtime.ConstrainedExecution;

using System.Security;

using System.Text;


namespace System {

public static class Console {

// Middle slightly

}

}

You can see the Console type from this assembly mscorlib.dll. From the above experiments can be seen, whether we refer to mscorlib.dll assembly, it will automatically reference. This program contains the library, which is the title of this section in the BCL (Base Class Library, the base class library). Can be seen from the name, the library contains are some of the most basic type, its already and the CIL language into a lift, which provides the basis for the CIL programming language support, so that the library has become part of the standard CLI (will be introduced, therefore said to be behind the type, type BCL is the CIL language all oriented CIL language can use them. We can use the object browser (Visual Studio &rarr &rarr menu; view; the object browser) to view the mscorlib.dll assembly contains what the namespace and type, as shown in Figure 6-7.

Contains the 6-7 namespace in mscorlib.dll

You can see the program set is included in the System namespace, a little a bit more careful reader will find, in the new project, but also contains a System.dll assembly, and the type and mscorlib contained in the very similar.

Figure 6-8 System assemblies

Contains the 6-9 namespace in System.dll

This is how to return a responsibility? In fact, as long as opening the System namespace will find, a completely different type defines the following namespace in System type and System.dll defines the following System namespace mscorlib.dll, and there is no conflict between them.

Now understand: BCL provides types like Console to support developers to write such a program similar to the console.

Since I have thought so much, might as well go further, consider such a question: write down the statement string text = “ Hello, ” world!, where string come from? From the intuition, string appear in dark blue Visual Studio, belongs to the C# keyword, then it should be C# provides built-in types. However, when we move the cursor to string and press F12 to string, definition, see below is such content:

#Region assembly mscorlib.dll, v4.0.30319

// C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll

#endregion


using System.Collections;

using System.Collections.Generic;

// In order to save space, omitted some using


namespace System {

public sealed class String : IComparable, ICloneable, IConvertible, IComparable<string>, IEnumerable<char>, IEnumerable, IEquatable<string> {

// Omit the definition

}

}

Note that the above procedure set address, once again saw the mscorlib.dll, and the String type and Console type, and in the System namespace. Thus, the C# keyword string, but is an alias for the System.String type in BCL. Similarly, VB.NET String keyword is BCL in System.String type alias. Therefore, in the framework of.NET, the language is essentially not much difference, more is the difference in grammar. From the above examples can be seen, C# and VB.NET of many language ability is not their own, but from the CIL“ ” to do that in different languages corresponding types of behavior that is consistent with the.

Table 6-1 lists several typical, correspondence between different language keywords and CIL type. I think understanding in memory, so there are only a few. To understand the other basic type, just move the cursor to the type, and then press the F12 key on it.

Corresponding relationship between the 6-1 language keywords and CIL type

CIL type C# VB.NET byte Byte Sytem.Int16 keyword keyword System.Byte short Short System.Int64 long Long

It is seen from table 6-1,.NET also provides support for language developers. If you need to design a language, so in the development of the compiler maps the key language as the type of CIL can be, that is to say, for some special symbols in their language (keywords) mapping processing, like C# keywords in int and string.

You may have heard of such a special type — — primitive types (Primitive Type). In fact, here we should understand, those directly by the compiler support, will language keyword type is converted to CIL type, called the element type. Obviously, the above byte, int, string are all primitive types. While C# is not a keyword to the mapping of Console, so we think Console is just an ordinary class type(Class Type).

6.3.2 FCL——Framework class library

As a.NET programmer, to deal with every day is FCL (Framework Class Library, framework class library). In the last section introduces BCL, which is a subset of FCL. BCL contains a core type closely with the compiler and CIL language relations, will use all types and common development tasks. FCL contains many, only serve an application scenario of sub library is enough to write a book, here simply introduce it.

From the functional point of view, the FCL framework class library is divided into the following layers.

6.4 CTS——The common type system

Suppose you want to develop a new language, the language and the C# or VB.NET, the compiler can also generate CIL code, can also be run in the.NET environment, then what is needed?

According to the story of 6.2 section we know, the new language to develop the equivalent of CIL language version, so in fact what to do is not determined by a new language, but by the CIL to decide. Therefore, the definition of a CIL, rules or standards. This set of rules define our language can do, not what you can do, what are the characteristics of. This set of rules is called CTS (Common Type System, the common type system). Any meet high-level language of this set of rules can be called a framework for the.NET language. C#And VB.NET is Microsoft developed a set to conform to the language of the CTS, in fact there are many organizations or groups, they have developed such a language, such as Delphi.Net, FORTRAN etc.

The CTS includes what content? Before answering the question we need to clarify a concept. To illustrate or through a C# code, please see the following a few lines of code:

public class Book {

// Omit implementation

}

Book item1 = new Book();

Book item2 = new Book();

The above code, usually so described: define a Book class, and create two instances of the Book class Item1, item2. In fact it only contains two layers of meaning as shown in table 6-2.

Table 6-2 class, a class instance

An instance of the Book class, Item1 class, item2

To think of it, there is a higher level, that is Book this class type, which we call the class type (Class Type), so the table can be changed as shown in table 6-3.

Table 6-3 class type, class, class

Class class class instance of the Book class Item1, item2

Similarly, there is an enumerated type (Enum Type), structure ((Struct Type) and other types of. Now we should understand what to say here, CTS provides the language definition such as a class, structure, or types, these rules define the higher language level content. Therefore, in the C# for this specific language, we can define a class type (Class Type) or structure type (Struct Type).

Similarly, we can define a name field in the Book class and provides a method (ShowName). In fact, these are defined in the CTS specification, it can be included in the type field (filed), property (property), method (method), events (event) etc.

In addition to define various types, CTS also provides a variety of access, such as Private, Public, Family (C# Protected), Assembly (C# internal), Family and assembly (C# Family or does not provide an implementation), assembly (C# protected internal).

CTS also defines a number of constraints, for example, all types are implicitly inherited from the System.Object type, all types are inherited from a base class. From the CTS name and the common type system can be seen, not only C# language to satisfy these constraints, all.NET oriented language will need to meet these constraints. As everyone knows, the traditional C++ can inherit from multiple base classes. In order to get familiar with the C++ language developers can develop applications on the.NET framework, Microsoft launched.NET oriented C++/CLI language (also called the managed C++), it is consistent with CTS new C++ language, in order to meet the CTS specification, it is restricted to only inherits from a base class.

On the above contents are two highlights:

1)C#Do not provide Family and assembly, no global methods in C# (Global Method). In other words, C# achieves only a part of the function CTS. The CTS specification, that is to say, all the language ability can be achieved, but in accordance with the specification language CTS to achieve all of the features do not necessarily achieve defined by the CTS specification.

2)C++/CLI is constrained to be inherited from a base class, in other words, some of the features in C++ was deleted. That is to say, in any language, according to the CTS, some of the functions are not compatible with CTS are discarded.

Obviously, since CIL is understood by the.NET runtime language, so it realizes all the functions of the CTS. Although it is a low-level language, but in fact, its function more complete. The relationship between C# language and CIL, can be represented by a graph 6-10.

The relationship between 6-10 C# and CIL

6.5 CLS——The common language specification

Since already understand the CTS is a set of linguistic rules define, you can develop a language to comply with CTS. Suppose that the language is called N#, which implements the CTS is very limited, only a few of them part of the function, its relationship with CTS and C# language may be as shown in Figure 6-11.

6-11 C#, the relationship between N# and CIL

So now there is a problem: C# prepared by the procedures set, can be referenced by the N# program set? The answer is obviously not,, although C# and N# belong to CTS's, but they are not in common. Therefore, although the individual N# or C# program can run perfectly under the framework of.NET, but they do not reference each other. If you use the N# development project developers didn't want other language types of projects refer to his project to be it, but, if the N# project expect other language types of projects will be able to make the reference, requires the types and functions of open N# meet the features of the C# language, namely, they need to have something in common. Note, this sentence has a word is very important, is “ the public”(public). N#Do not open part of (private, internal, protected) are not affected, can use the language features unique, because these private part would not allow external access. Therefore, if N# want to be C# understanding and reference, it discloses part to meet some criterion, C# at this time, it would have relationship with CTS and C# language becomes as shown in Figure 6-12.

Figure 6-12 the C#, N#, CIL relationship

If the world only C# and N# two kinds of language is easy, their language characteristics in common is extracted, and then asked all the open type satisfy these properties of language, so C# and N# assemblies can reference each other. The problem is: language types have hundreds of types of design goals, and.NET is an open platform, not only the existing language through simple modifications can be run in the.NET framework, the new language follow-up development can also, and the new language at this time does not exist, how to extract the features of the language of it? So they need a set of norms and standards to define some common, most languages are common linguistic characteristics. The new language in the future, as long as it open part can meet these specifications, can be used in other language program. This specification is called CLS (Common Language Specification, the common language specification). Obviously, CLS is a subset of CTS. Now the introduction of the CLS, FIG. 6-12 can change as shown in Figure 6-13.

Figure 6-13 language, CLS, CIL relationship

If the public parts of a program using C# development set using only the features of CLS, then the assembly is called CLS compliant assemblies (CLScompliant assembly). Clearly, the library FCL framework mentioned above, one of the types are compatible with CLS, only a few types of members are not in compliance with the CLS, the.NET oriented language can use the type of frame in the class library.

Now, the reader will have a doubt: repeated the above paragraphs of text in a word — — — “ language characteristics of ” (language features), CLS is the required language features to meet the agreed, then what is language? Here are some specific characteristics: language is case sensitive, how the naming rules for identifiers, what are the basic types that can be used, the constructor is called (whether it will call the superclass constructor), support access modifiers.

So how do we test whether an assembly in accordance with CLS? .NET provides a CLSCompliant for us, it is easy to check whether the assembly in accordance with CLS at compile time. We see an example below:

using System;


[assembly:CLSCompliant(true)]


public class CLSTest {


public string name;


// Warning: only the case different identifier (&ldquo); CLSTest.Name ” does not conform to CLS

public string Name() {

return "";

}


// Warning: “ CLSTest.GetValue (&rdquo); return type does not conform to CLS

public uint GetValue() {

return 0;

}


// Warning: the parameter type “ sbyte” does not conform to CLS

public void SetValue(sbyte a) { }


// Warning identifier “ CLSTest._aFiled” does not conform to CLS

public string _MyProperty { get; set; }

}

Note that, in front of the CLSTest class to the assembly with the characteristics of a CLSCompliant, show that the assembly is compatible with CLS. However, there are three does not satisfy this requirement, so the compiler warning information is given. The three is:

Also notice, only then the compiler warning information, rather than the error information, so we can ignore the compiler warning, but this assembly can only be written by other C# language program to use.

6.6 CLR——The common language runtime

The 6.6.1 assembly overview

The previously mentioned: the assembly contains the CIL language code, and CIL code is not directly run, need to pass the.NET runtime machine instructions to convert instantaneous compiling computer can directly execute. Then the process is to be carried out.?

The core part of what we want to know is.NET framework: CLR (Common Language Runtime), the common language runtime), sometimes called the.NET runtime (.NET runtime). In the understanding of CLR advanced step before, need to learn about the assembly, because the next day will be specialized on the assembly, here only introduce the assembly for the understanding of CLR useful concept.

From the intuitive point of view, the front for the suffix to.Exe console application is a directly executable file, because in the double click on it, it will be up and running. The situation here and inheritance in object oriented is a bit like: a car is a vehicle, a cat is an animal, and a.NET assembly is first of all a Windows executable program.

So what kind of file format is a Windows executable file? This format is called PE/COFF (Microsoft Windows Portable Executable/Common Object File Format), Windows portable executable / common object file format. Windows operating system can be loaded and run the.Dll and.Exe because it can understand the format of PE/COFF file. Obviously, all running on the Windows operating system procedures are required to comply with this format, including.NET assembly. At this level, control program also belong to the operating system, the PE/COFF header contains the operating system for the view and use of information. At this time, the assembly can be expressed as shown in Figure 6-14.

Figure 6-14 assembly structure 1

That said, the program included CIL language code and not the computer can be directly implemented, still need time compilation, then in the CIL language code, need to run the compiler environment, so the PE/COFF head after the head is CLR. One of the effects of CLR first and the most important is to tell the operating system to the PE/COFF file is a.NET assembly, distinguished from other types of executable program.

Figure 6-15 assembly structure 2

In the CLR header after everyone is relatively familiar with some content. Firstly, the assembly includes a list (manifest), this list is equivalent to a directory, describes the assembly itself, such as the assembly identity (name, version, culture), the assembly containing resources (Resources), composed of the assembly file etc.

Figure 6-16 assembly structure 3

List is metadata. If the list describes the assembly's metadata information, then describes the assembly contains content. These contents include: assembly contains the modules (will be discussed in Chapter seventh), type, type member, types and type members visibility. Note, the metadata does not contain the type of implementation of.H header files, similar to C++. In.NET, the process is called the reflection view metadata(Reflection).

Figure 6-17 assembly structure 4

The next step is to have converted to CIL code, is also the metadata types, including methods, fields, similar to C++ in the.Cpp file.

Figure 6-18 assembly structure

Note that, in Figure 6-18 also added a resource file, such as.Jpg. From the picture we can see, the assembly is self explanatory type (Self-Description), do not need any extra things, such as the registry, you can fully know all the information for the assemblies.

This brief introduction to the assembly first here, then look at the assembly is to be executed.

6.6.2 operating procedures set

Now read the assemblies, and that the program included CIL code and can not directly run, also need the support of CLR. Generally speaking, CLR is a software layer or agent, it manages the.NET assembly implementation, including: management application domain, loading and running the assembly, the security check, the CIL code JIT compiler into machine code, exception handling, object destruction and waste recycling. With respect to the compile time (Compile time), these processes occur during the execution of a program, therefore, the software layer named to run, in fact itself with time is not much relationship. Some of my friends in the.NET beginner, tangled in the word Runtime, always think and what is the relationship between the time, always cannot very good understanding of CLR. I think it is important to understand what CLR is, without too much attention to its name.

In fact, CLR also has a name, that is VES (Virtual Execution System, virtual execution system). From a description, this name should be more able to describe the role of CLR, also not easy to cause confusion, but may order and CIL, CTS, CLS and other terms to maintain consistency, the final will be named CLR. Here, we know CLR is just an environment.NET assemblies, somewhat similar to the Java virtual machine. The term VES from CLI, will be explained in section 6.7.

The main role can use 6-19 to describe CLR.

The main function of 6-19 CLR

We have briefly about the role of CLR, then began to further study. The first problem is: in what form CLR in what position?

Since the CLR itself is used to manage the managed code, thus it is written by unmanaged code, and not a managed code assembly, also cannot use IL DASM to view. It is located in the C:\%SystemRoot%\Microsoft.NET\Framework\ version, as the machine has two versions, a workstation version of mscorwks.dll, is a version of the server mscorsvr.dll. Wks and SVR represent the work station and server.

Now look at how the CLR is up and running. Although from Windows Server 2003,.NET framework has been installed in the operating system, but it is not set to become part of the operating system. When the operating system attempts to open a managed assembly (.Exe), it first checks the PE header, to create the appropriate process based on PE.

Then further checks for the presence of the CLR header, if present, will immediately loading MsCorEE.dll. The library is one of the core component of the.NET framework, it is not an assembly. MsCorEE.dll is located in the C:\%SystemRoot%\System32\ system folder of all computer installed.NET framework will have this file. You may have noticed, this library is installed in the System32 system folder, and did not like the other core components or libraries that in accordance with the version number is stored in the C:\%SystemRoot%\Microsoft.NET\Framework\ folder. Here again there is a chicken and egg problem “ ”: according to the different assembly information will load the different versions of CLR, so the assembly load CLR should have only one, not according to the version of the CLR to determine the component loading CLR version.

MsCorEE.dll is a very thin layer of software. After loading the MsCorEE.dll, will call one of the _CorExeMain () function, this function will load the proper version of the CLR. In the CLR after the operation, the execution of the program is to CLR. CLR will find the entrance point of a program, usually Main () method, and then execute it. It contains the following process:

  1. Type of loading. In the implementation of the Main () method before, first to find Main (have) type and loading method of this type. A CLR named Class loader (class loader) component responsible for this work. It will be from the GAC configuration file, assembly, looking for the types of metadata, and then type information loading it into a data structure in memory. After the Class loader to find and load the type, type information it will be cached, so without the same process again. After loading the class, but also for each of its methods to insert a stub(stub).
  2. Verification. In CLR, there is also a verification program (verifier), the verification of the work is in operation to ensure that the code is type safe. Two aspects mainly check, a metadata is correct, one is the CIL code must be type safe, the signature must be the correct type.
  3. Just in time compilation. This step is managed CIL code compiled to process can execute machine code, by CLR (JIT Complier) to complete the JIT compiler. JIT compiled only the first call in the method when the. In retrospect, type loader will insert a stub for each method. When calling a method, CLR checks the method stubs, if the stub is empty, executing JIT compilation process, and the method is compiled to native machine code written to a method stub in the address. When the second times on the same method is invoked, the stub will check again, if it is found that the preservation of the native machine code address, then jump directly to the local machine code execution, again without the JIT compiler.

As can be seen, the one advantage of this architecture is that,.NET programs can run on any platform, whether it is Windows, UNIX, or other operating system, as long as the platform with the.NET framework for the operating system can run.NET assemblies.

6.7 CLI——Common language infrastructure

CLI is an international standard, ECMA and ISO are standardized, called Common Language Infrastructure (common language infrastructure). It is only a concept and summary, in fact every section of this chapter are part of the standard. CLI includes: CIL, CTS, CLS, VES, metadata, framework.

See here a lot of people will feel a little strange, why include CLI and.NET framework content all the same? What is the relationship between them? In simple terms, CLI is a standard, and the.NET frame is the realization of this standard. In the CLI, not the concept of CLR, only VES, and CLR is.NET in the framework of the realization of VES. Since CLI is a standard, and the.NET framework is its implementation on the Windows platform, so is it right? The only.NET framework of this CLI? Obviously not, another implementation of Mono Project is the CLI standard. Mono Project is the goal of the.NET framework for multi platform, which can run on various platforms, including Mac, OS, Linux etc.

Details of the CLI can be read here:, interested friends can download PDF standard document it look.

Summary this chapter 6.8

This chapter to study the system of the basic knowledge about the.NET framework, almost contains all the common term, such as assembly, CIL, CTS, CLS, CLR, and also introduces how to cooperate between them is to build up the.NET platform. Believe that through the study of this chapter, we will all have a better understanding of the.NET framework.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Robert at November 14, 2013 - 4:40 AM