Chapter 1 The CLR's Execution Model

When you decided to use .Net,you must determine what typ of application or component to build,and must decide which programming language to use,so so ,i suggest that you can begin with C++,because the C++ has higher salary,in my opinion

The Common Language Runtime is just what its name says it is:a runtime that is usable by different language and varied programming languages,The core features of the CLR(such as memory management,assembly loading,security,exception handing,and thread synchronization).
CLR is something like java virtual machine,a runtime,management resource(memory managment,garbage collection),and ensure the necesssary separation between application and the underlying operating system.
In order to improve the stability of the platform,CLR also responsible for other tasks,such as operatiion of the monitoring program.

In fact,at runtime,clr has no idea which programming language the developer used for the source code,this means that you should choose whatever programming language allows you to express your intention most easily,you can develop your code in any programming language you desire as long as the compiler you use to compile your code targets the clr.

Regardless of which compiler you use,the result is amanaged module,Amanaged module is standard 32-bit ms windows portable executable or 64-bit file that requires clr to execute,by the way managed assemblies always take advantage of data execution prevention and address space layoyt randomization in windows  these two features improve the security of your whole system

A Managed Module contain four parts:
PE32 or PE32+ header:which is similar to the common object file format(COFF) header.This head indicates the type of file:GUI,CUI or DLL,and  contains a timestamp indicating hwen the file was built ,For modules that contain only IL code,the bulk of the information in the PE32(+) header is ignored,For modules that contain native CPU code,this header contains information about the native CPR code

CLR header Contain the information(interpreted by the CLR and utilities)that makes this a managed module,The header includes the version of the CLR required,some flags,the MethodDef of meatadata token of the managed module;s entry point method,and the location size of the module;s metadata,resources,strong name,some flags,and other less interesting stuff

Metadata:Every managed module contains metadata tables.Describe the tyoes and memebers defined in your source code and tables that describe the types and member s referenced by your source code

IL Its means Source Code

Obviusly,CLR is all about types,CTS is how the types defined and how they behave.The CTS specification states that a tyoe can contain zero or more members

CTS alse specifies the rules for type visibility and access to the memeber s of a type.

And last,CTS has another rule,All types must inherit from a predefined type:System.Object,so,It allows you to do the samething.

CLS is something you must expose Function or Member clear and usable for every language.


For example:

Public a:

{

public void a();

public void A();//has the same name

private Int32 A();//type not clear

private void c();//can't private

}

 

posted @ 2013-04-10 18:00  爱喝可乐  阅读(237)  评论(0编辑  收藏  举报