计算机专业 外文翻译 外文文献 英文文献 NET Framework介绍.doc

上传人:laozhun 文档编号:2326203 上传时间:2023-02-11 格式:DOC 页数:9 大小:40.50KB
返回 下载 相关 举报
计算机专业 外文翻译 外文文献 英文文献 NET Framework介绍.doc_第1页
第1页 / 共9页
计算机专业 外文翻译 外文文献 英文文献 NET Framework介绍.doc_第2页
第2页 / 共9页
计算机专业 外文翻译 外文文献 英文文献 NET Framework介绍.doc_第3页
第3页 / 共9页
计算机专业 外文翻译 外文文献 英文文献 NET Framework介绍.doc_第4页
第4页 / 共9页
计算机专业 外文翻译 外文文献 英文文献 NET Framework介绍.doc_第5页
第5页 / 共9页
点击查看更多>>
资源描述

《计算机专业 外文翻译 外文文献 英文文献 NET Framework介绍.doc》由会员分享,可在线阅读,更多相关《计算机专业 外文翻译 外文文献 英文文献 NET Framework介绍.doc(9页珍藏版)》请在三一办公上搜索。

1、.NET Framework介绍Alex Kriegel1.NET Framework是Microsoft为开发应用程序而创建的一个富有革命性的新平台。这句话最有趣的地方是它的含糊不清,但这是有原因的。首先,注意这句话没有说“在Windows操作系统上开发应用程序”。尽管.NET Framework的Microsoft版本运行在Windows操作系统上,但以后将推出运行在其他操作系统上的版本,例如Mono,它是.NET Framework的开发源代码版本(包含一个C#编译器),该版本可以运行在几个操作系统上,包括各种Linux版本和Mac OS.Microsoft .NET Compact F

2、ramework(基本上是完整 .NET Framework的一个子集)。使用.NET Framework的一个主要原因是它可以作为集成各种操作系统的方式。另外,上面给出的.NET Framework定义并没有限制应用程序的类型。这是因为本来就没有限制。.NET Framework可以创建Windows应用程序、Web应用程序、Web服务和其他各种类型的应用程序.NET Framework的设计方式保证它可以用于各种语言,包括C#语言,C+、Visual Basic、JScript,甚至一些旧的语言,如COBOL。为此,还推出了这些语言的.NET版本,目前还在不断推出更多的.NET版本的语言。

3、所有这些语言都可以访问.NET Framework,它们还可以彼此交互。C#开发人员可以使用Visual Basic程序员编写的代码,反之亦然。所有这些提供了意想不到的多样这也是.NET Framework具有诱人前景的部分原因。2.NET Framework主要包含一个非常大的代码库,可以在客户语言(如C#)中通过面向对象编程技术(OOP)来使用这些代码。这个库分为不同的模块,这样就可以根据希望得到的结果来选择使用其中的各个部分。例如,一个模块包含Windows应用程序的构件,另一个模块包含联网的代码块,还有一个模块包含Web开发的代码块。一些模块还分为更具体的子模块,例如在Web开发模块中

4、,有用于建立Web服务的子模块.其目的是,不同的操作系统可以根据 自己的特性,支持其中的部分或全部模块。例如,PDA支持所有的核心.NET功能,但不需要 某些更深奥的模块。 部分.NET Framework库定义了一些基本类型。类型是数据的一种表达方式,指定其中最基础的部分(例如32位带符号的整数),以便使用.NET Framework在各种语言之间进行交互操作。这称为通用类型系统(Common Type System,CTS).除了支持这个库以外,.NET Framework还包含.NET公共语言运行库(Common Language Runtime,CLR),它负责管理用.NET库开发的所

5、有应用程序的执行。3.如何用.NET Framework编写应用程序.使用.NET Framework编写应用程序,就是使 用.NET代码库编写代码(使用支持Framework的任何一种语言).VS是一种强大的集成开发环境,支持C#(以及托管和非托管C+、Visual Basic和其他一些语言)。这个环境的优点是便于把.NET功能集成到代码中。我们创建的代码完全是C#代码,但使用.NET Framework,并在需要时利用VS中的其他工具。为了执行C#代码,必须把它们转换为目标操作系统能够理解的语言,即本机代码,这种转换称为编译代码,由编译器执行。但在.NET Framework下,这个过程分

6、为两个阶段。4. MSIL和JIT在编译使用.NET Framework库的代码时,不是立即创建操作系统特定的本机代码,而是把代码编译为Microsoft中间语言(Microsoft Intermediate Language,MSIL)代码,这些代码不专用于任何一种操作系统,也不专用于C#。其他.NET语言,如Visual Basic .NET也可以在第一阶段编译为这种语言,当使用VS开发C#应用程序时,编译过程就由VS完成。显然,要执行应用程序,必须完成更多的工作,这是Just-In-Time(JIT)编译器的任务,它把MSIL编译为专用于OS和目标机器结构的本机代码。这样OS才能执行应用

7、程序。这里编译器的名称Just-In-Time反映了MSIL仅在需要时才编译的事实。过去,常常需要把代码编译为几个应用程序,每个应用程序都用于特定的操作系统和CPU结构。这通常是一种优化形式(例如,为了让代码在AMD芯片上运行得更快),但有时是非常重要的(例如对于工作在Win9x 和 WinNT/2000环境下的应用程序)。现在就不必要了,因为顾名思义,JIT编译器使用MSIL代码,而MSIL代码是独立于机器、操作系统和CPU的。目前有几种JIT编译器,每种编译器都用于不同的结构,我们总能找到一个合适的编译器创建所需的本机代码。 这样,用户需要做的工作就比较少了。实际上,可以不考虑与系统相关的

8、细节,把注意力放在代码的功能上就够了。5. 程序集在编译应用程序时,所创建的MSIL代码存储在一个程序集中,程序集包括可执行的应用程序文件(这些文件可以直接在Windows上运行,不需要其他程序,其扩展名是.exe)和其他应用程序使用的库(其扩展名是.dll)。除了包含MSIL外,程序集还包含元信息(即程序集中包含的数据的信息,也称为元数据)和可选的资源(MSIL使用的其他数据,例如声音文件和图片)。元信息允许程序集是完全自我描述的。不需要其他信息就可以使用程序集,也就是说,我们不会遇到下述情形:不能把需要的数据添加到系统注册表中,而这种情形在使用其他平台进行开发时常常出现。因此,部署应用程序

9、就非常简单了,只需把文件复制到远程计算机上的目录下即可。因为不需要目标系统上的其他信息,所以只需从该目录中运行可执行文件即可(假定安装了.NET CLR)。当然,不必把运行应用程序所需要的所有信息都安装到一个地方。可以编写一些代码,执行多个应用程序所要求的任务。此时,通常把这些可重用的代码放在所有应用程序都可以访问的地方。在.NET Framework中,这个地方是全局程序集高速缓存(Global Assembly Cache,GAC),把代码放在这个高速缓存中是很简单的,只需把包含代码的程序集放在包含该高速缓存的目录下即可。6. 托管代码在把代码编译为MSIL,再用JIT编译器把它编译为本机

10、代码后,CLR的任务还没有全部完成。用.NET Framework编写的代码在执行(这个阶段通常称为运行时(runtime)时是托管的。即CLR管理着应用程序,其方式是管理内存、处理安全性,以及允许进行跨语言调试等。相反,不在CLR控制之下运行的应用程序是非托管的,某些语言如C+可以用于编写这类应用程序,例如,访问操作系统的低级功能。但是,在C#中,只能编写在托管环境下运行的代码。我们将使用CLR的托管功能,让.NET自己与操作系统进行交互。7. 垃圾回收 托管代码最重要的一个功能是垃圾回收(garbage collection)。这种.NET方法可确保应用程序不再使用某些内存时,这些内存就会

11、被完全释放。在.NET推出以前,这项工作主要由程序员负责,代码中的几个简单错误会把大块内存分配到错误的地方,使这些内存神秘失踪。这通常意味着计算机的速度逐渐减慢,最终导致系统崩溃。 .NET垃圾回收会频繁检查计算机内存,从中删除不再需要的内容。它没有设置时间帧,可能一秒钟内会进行上千次的检查,也可能几秒钟检查一次,或者随时进行检查,但可以肯定进行了检查。 这里要给程序员一些提示。因为这项工作在不可预知的时间进行,所以在设计应用程序时,必须记得要进行这样的检查。需要许多内存才能运行的代码应自己执行这样的检查,而不是坐等垃圾回收,但这不像听起来那样难。8. 把它们组合在一起 在继续学习之前,先总结

12、一下上述创建.NET应用程序所需要的步骤:(1)使用某种.NET兼容语言(如C#)编写应用程序代码,如图1-1所示。 (2)把代码编译为MSIL,存储在程序集中. (3) 在执行代码时(如果这是一个可执行文件,就自动运行,或者在其他代码使用它时运行),首先必须使用JIT编译器将代码编译为本机代码,如图1-3所示。(4)在托管的CLR环境下运行本机代码,以及其他应用程序或过程.9. 链接在上述过程中还有一点要注意。在第(2)步中编译为MSIL的C#代码不一定包含在单独的文件中,可以把应用程序代码放在多个源代码文件中,再把它们编译到一个程序集中。这个过程称为链接,是非常有用的。原因是处理几个较小的

13、文件比处理一个大文件要简单得多。可以把逻辑上相关的代码分解到一个文件中,以便单独处理它,这也更易于在需要代码时找到它们,让开发小组把编程工作分解为可管理的块,让每个人编写一小块代码,而不会破坏已编写好的代码部分或其他人正在处理的部分。.NET Framework IntroduceAlex Kriegel1.NET Framework for the development of Microsoft applications and the creation of a rich a revolutionary new platform. This case is most interestin

14、g is its vague, but this is a reason for this. First of all, pay attention to this statement did not say in the Windows operating system development and application procedures. Although. NET Framework version runs on Microsoft Windows operating system president, but future operations will be launche

15、d in other versions of the operating systems, such as Mono, It yes. NET Framework development of the source code version (including a C # compiler). This version can run on several operating systems, including Linux and the Mac OS.Microsoft. version NET Compact Fr amework (basically intact. NET Fram

16、ework of a subset). Use. NET Framework is a major cause of it as the operating system of integrating all kinds of ways. In addition, as given above. NET Framework definition does not limit the type of application. This is because there is no restriction. . NET Framework can create Windows applicatio

17、ns, Web applications, Web and various other types of procedures should be used . NET Framework design approach to ensure that it can service to be used in various languages, including C #, C + +, Visual Basic, and JScript. even some of the old language, such as COBOL. Therefore, in addition to the i

18、mplementation of these languages. NET version, currently still has introduced more. NET version of the language. All of these languages can visit. NET Framework, they can cross each other. C # developers can use Visual Basic programmers to prepare the code, and vice versa. All of these provide an un

19、expected diversity, This is. NET Framework with the enticing prospect of reasons. 2.NET Framework mainly contains a very large code library. customers in languages (such as C #) through object-oriented programming (OOP) to use these codes. The library is divided into different modules, thus can expe

20、ct the result to choose to use the various parts. For example, a module includes Windows application components, another networking module containing the code block, There is also a Web module contains the code block. development Some modules also divided into more specific sub-module, such as the W

21、eb module development for the establishment of a Web module. service its purpose is different operating systems under their own identity, support for some or all modules. For example, the PDA support all of the core. NET function, but it does not need some of the more esoteric modules. Part. NET Fra

22、mework defines some of the basic types. Data type is a form of expression, designated one of the most basic elements (such as 32-bit integers with the symbol) to use. NET Framework in various languages between interoperability. This is known as the Common Type System (Common Type System. CTS). In ad

23、dition to supporting the library, . NET Framework also includes. NET common language runtime (Common Langua ge Runtime, CLR), which is responsible for management use. NET development for all applications implementation. 3. How to use. NET Framework applications development. Use. NET Framework prepar

24、ation of applications, is used. NET code for the preparation of code (using the Framework support any language). VS is a powerful integrated development environment, support for C # (and managed and unmanaged C + +. Visual Basic and other languages). The environmental advantages of the facilitates.

25、NET to integrate the functions of the code. We build the code is C # code, but use. NET Framework, and, if necessary, the use of VS other tools. In order to implement C # code, which must be converted to target operating system to solve language, which is the machine code This change as compiled cod

26、e, the compiler implementation. But. NET Framework, the process is divided into two phases4. Keyword and the JIT compiler in use. NET Framework library code, instead of immediately creating an operating system specific code of the machine, but put code compiler for Microsoft intermediate language (M

27、icrosoft Intermedi ate Language, keyword) code, the code is not exclusive to any one operating system. not exclusive to C #. Other. NET language, If Visual Basic. NET can be compiled in the first stage of this language, When using VS C # application development, build on the process completed by VS.

28、 Obviously, the implementation of the applicable procedures must complete more work, This is Just-In-Time (JIT) compiler task It put keyword compiler for OS and dedicated to the goal of the machine structure for the code. This OS can implement applications. Here compiler Just-In-Time the name reflec

29、ts the keyword only need to do a translation of the facts. Past, we often need to compile code for several applications, Each application procedures for specific operating systems and CPU structure. This is usually an optimal form (for example, in order for the code in the AMD chips run faster). But

30、 sometimes it is very important (for instance, in Win9x WinNT/2000 environment and the application process Prologue). Now unnecessary because, as the name implies, JIT compiler uses keyword code and keyword code is independent of machine, operating system and CPU. There are several JIT compiler, eac

31、h compiler are used for different structures, We can always find a suitable compiler is the creation of the machine code. Thus, users need to do a far less. In fact, they do not consider the details related to the system, giving attention to the functional code will be enough. 5. Program Set compile

32、d application, citing the keyword code stored in a centralized procedure. Set procedures including the application executable files (which can be directly run on Windows. no need for other procedures, expansion are. exe) and other applications that use the library (expansion are. dll). In addition t

33、o include keyword, the procedures set also includes meta-information (that is, procedures focus on the data contained in the information, also known as metadata) and the optional resources (keyword used by other data, such as sound files and pictures). Yuan procedures allow information collected is

34、completely self-described. No other information on the procedures for collection, in other words, we do not encounter the following circumstances : not requiring the data added to the system registry. and the use of this kind of situation in other platform development often arise. Therefore, the dep

35、loyment of applications it is very simple, just put the paper copy to the remote computer directory can be. Not the target system because of other information, So just from the CONTENTS run executable files can be (assuming installed. NET CLR). Of course, we do not have the applications needed to in

36、stall all the information in one place. You can make some code, the implementation of a number of applications required tasks. At this time, these are usually reusable code on all applications can access areas. In. NET Framework, this is a definitive collection procedures Cache (Global Assembly Cach

37、e, the GAC). code or on the high-speed cache is very simple. needs to do is include the code on the procedures set contains the cache directory can be. 6. Trust code compiler for code or keyword and then JIT compiler it compiler - based machine code, CLR task is not completed. Used. NET Framework pr

38、epared by the implementation of the code (often referred to as the stage of operation (runti me) is the custodian. That the CLR manages the applications, and its methods are memory management, handling security, and allow for cross-language debugging. Conversely, not CLR running under control of non

39、-custody procedures, some languages such as C + + can be used in the preparation of such application, for example, visited the base operating system functions. However, in C #, can only prepare in the Trusteeship Council run under the code. We will use CLR functions of the Trusteeship Council,. NET

40、operating system with its own interactive. 7. Garbage collector managed one of the most important functions of the garbage collector (garbage collectio n). This species. NET will ensure that applications would no longer use certain memory, the memory which will be completely released. In. NET introd

41、uced to the former, this primarily by programmers responsible, code of a few simple mistakes will be large memory allocation to the wrong places, so that these mysterious disappearance of memory. This usually means that the speed of the computer has gradually slowed down and eventually led to the co

42、llapse. . NET trash recycling frequent checks of computer memory, will no longer need to remove the contents. It does not set the time frame may be one of seconds for the 1,000 th inspection, may also check a few seconds. or check at any time, but certainly for the inspection. Here to give programme

43、rs some hints. Because this work in an unpredictable time, the application of the design process, we must remember to conduct such inspections. Many memory needed to run their own code of the implementation of such checks, instead of waiting for the garbage collector. But this did not sound difficul

44、t.8. The combination of them in continuous learning, first summarize the above building. NET applications needed steps : (1) the use of some. NET-compatible languages (eg C #) prepared application code (2) the provision into keyword code, stored in the centralized procedure, as shown in Figure 1-2.

45、(3) the code (if it is an executable file that will automatically run or other code to run when to use it), it must first use of JIT compiler to compile code-based machine code, as shown in Figure 1-3. (4) in the Trusteeship Council the CLR environment for the operation code, and other applications

46、or processes, as shown in Figure 1-4.9. Links in these processes Another point to note.step compiler for the C # code keyword is not always included in a separate document, Application procedures can be code on a number of source documents, and then compile them into a centralized procedure. This pr

47、ocess is known as link is very useful. The reason is handling several smaller than handling paper documents to a much more simple. Can be logically related to the decomposition of a code document to deal with it alone, It also needs more easily find their code, development teams have programmed decomposition of manageable pieces Let everyone prepare a small piece of code, which would not undermine the code has been prepared for a good part or other people are handling parts.

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 建筑/施工/环境 > 项目建议


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号