2023年全國(guó)碩士研究生考試考研英語(yǔ)一試題真題(含答案詳解+作文范文)_第1頁(yè)
已閱讀1頁(yè),還剩8頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、<p>  .NET Framework介紹</p><p>  Alex Kriegel</p><p>  1.NET Framework是Microsoft為開(kāi)發(fā)應(yīng)用程序而創(chuàng)建的一個(gè)富有革命性的新平臺(tái)。這句話最有趣的地方是它的含糊不清,但這是有原因的。首先,注意這句話沒(méi)有說(shuō)“在Windows操作系統(tǒng)上開(kāi)發(fā)應(yīng)用程序”。盡管.NET Framework的Microsoft版本運(yùn)

2、行在Windows操作系統(tǒng)上,但以后將推出運(yùn)行在其他操作系統(tǒng)上的版本,例如Mono,它是.NET Framework的開(kāi)發(fā)源代碼版本(包含一個(gè)C#編譯器),該版本可以運(yùn)行在幾個(gè)操作系統(tǒng)上,包括各種Linux版本和Mac OS.Microsoft .NET Compact Framework(基本上是完整 .NET Framework的一個(gè)子集)。使用.NET Framework的一個(gè)主要原因是它可以作為集成各種操作系統(tǒng)的方式。另外,上面

3、給出的.NET Framework定義并沒(méi)有限制應(yīng)用程序的類型。這是因?yàn)楸緛?lái)就沒(méi)有限制。.NET Framework可以創(chuàng)建Windows應(yīng)用程序、Web應(yīng)用程序、Web服務(wù)和其他各種類型的應(yīng)用程序..NET Framework的設(shè)計(jì)方式保證它可以用于各種語(yǔ)言,包括C#語(yǔ)言,C++、Vis</p><p>  這也是.NET Framework具有誘人前景的部分原因。</p><p>  

4、2.NET Framework主要包含一個(gè)非常大的代碼庫(kù),可以在客戶語(yǔ)言(如C#)中通過(guò)面向?qū)ο缶幊碳夹g(shù)(OOP)來(lái)使用這些代碼。這個(gè)庫(kù)分為不同的模塊,這樣就可以根據(jù)希望得到的結(jié)果來(lái)選擇使用其中的各個(gè)部分。例如,一個(gè)模塊包含Windows應(yīng)用程序的構(gòu)件,另一個(gè)模塊包含聯(lián)網(wǎng)的代碼塊,還有一個(gè)模塊包含Web開(kāi)發(fā)的代碼塊。一些模塊還分為更具體的子模塊,例如在Web開(kāi)發(fā)模塊中,有用于建立Web服務(wù)的子模塊.其目的是,不同的操作系統(tǒng)可以根據(jù)

5、自己的特性,支持其中的部分或全部模塊。例如,PDA支持所有的核心.NET功能,但不需要 某些更深?yuàn)W的模塊。 部分.NET Framework庫(kù)定義了一些基本類型。類型是數(shù)據(jù)的一種表達(dá)方式,指定其中最基礎(chǔ)的部分(例如32位帶符號(hào)的整數(shù)),以便使用.NET Framework在各種語(yǔ)言之間進(jìn)行交互操作。這稱為通用類型系統(tǒng)(Common Type System,CTS).除了支持這個(gè)庫(kù)以外,.NET Framework還包含.NET公共語(yǔ)

6、言運(yùn)行庫(kù)(Common Language Runtime,CLR),它負(fù)責(zé)管理用.NET庫(kù)開(kāi)發(fā)的所有應(yīng)用程序的執(zhí)行。</p><p>  3.如何用.NET Framework編寫(xiě)應(yīng)用程序.使用.NET Framework編寫(xiě)應(yīng)用程序,就是使 用.NET代碼庫(kù)編寫(xiě)代碼(使用支持Framework的任何一種語(yǔ)言).VS是一種強(qiáng)大的集成開(kāi)發(fā)環(huán)境,支持C#(以及托管和非托管C++、Visual Basic和其他一些

7、語(yǔ)言)。這個(gè)環(huán)境的優(yōu)點(diǎn)是便于把.NET功能集成到代碼中。我們創(chuàng)建的代碼完全是C#代碼,但使用.NET Framework,并在需要時(shí)利用VS中的其他工具。為了執(zhí)行C#代碼,必須把它們轉(zhuǎn)換為目標(biāo)操作系統(tǒng)能夠理解的語(yǔ)言,即本機(jī)代碼,這種轉(zhuǎn)換稱為編譯代碼,由編譯器執(zhí)行。但在.NET Framework下,這個(gè)過(guò)程分為兩個(gè)階段。</p><p>  4. MSIL和JIT在編譯使用.NET Framework庫(kù)的代碼時(shí),

8、不是立即創(chuàng)建操作系統(tǒng)特定的本機(jī)代碼,而是把代碼編譯為Microsoft中間語(yǔ)言(Microsoft Intermediate Language,MSIL)代碼,這些代碼不專用于任何一種操作系統(tǒng),也不專用于C#。其他.NET語(yǔ)言,如Visual Basic .NET也可以在第一階段編譯為這種語(yǔ)言,當(dāng)使用VS開(kāi)發(fā)C#應(yīng)用程序時(shí),編譯過(guò)程就由VS完成。顯然,要執(zhí)行應(yīng)用程序,必須完成更多的工作,這是Just-In-Time(JIT)編譯器的任務(wù)

9、,它把MSIL編譯為專用于OS和目標(biāo)機(jī)器結(jié)構(gòu)的本機(jī)代碼。這樣OS才能執(zhí)行應(yīng)用程序。這里編譯器的名稱Just-In-Time反映了MSIL僅在需要時(shí)才編譯的事實(shí)。過(guò)去,常常需要把代碼編譯為幾個(gè)應(yīng)用程序,每個(gè)應(yīng)用程序都用于特定的操作系統(tǒng)和CPU結(jié)構(gòu)。這通常是一種優(yōu)化形式(例如,為了讓代碼在AMD芯片上運(yùn)行得更快),但有時(shí)是非常重要的(例如對(duì)于工作在Win9x 和 WinNT/2000環(huán)境下的應(yīng)用程序)?,F(xiàn)在就不必要了,因?yàn)轭櫭剂x,JIT編

10、譯器使用MSIL代碼,而MSIL代碼是獨(dú)立于機(jī)器</p><p>  5. 程序集在編譯應(yīng)用程序時(shí),所創(chuàng)建的MSIL代碼存儲(chǔ)在一個(gè)程序集中,程序集包括可執(zhí)行的應(yīng)用程序文件(這些文件可以直接在Windows上運(yùn)行,不需要其他程序,其擴(kuò)展名是.exe)和其他應(yīng)用程序使用的庫(kù)(其擴(kuò)展名是.dll)。除了包含MSIL外,程序集還包含元信息(即程序集中包含的數(shù)據(jù)的信息,也稱為元數(shù)據(jù))和可選的資源(MSIL使用的其他數(shù)據(jù),例

11、如聲音文件和圖片)。元信息允許程序集是完全自我描述的。不需要其他信息就可以使用程序集,也就是說(shuō),我們不會(huì)遇到下述情形:不能把需要的數(shù)據(jù)添加到系統(tǒng)注冊(cè)表中,而這種情形在使用其他平臺(tái)進(jìn)行開(kāi)發(fā)時(shí)常常出現(xiàn)。因此,部署應(yīng)用程序就非常簡(jiǎn)單了,只需把文件復(fù)制到遠(yuǎn)程計(jì)算機(jī)上的目錄下即可。因?yàn)椴恍枰繕?biāo)系統(tǒng)上的其他信息,所以只需從該目錄中運(yùn)行可執(zhí)行文件即可(假定安裝了.NET CLR)。當(dāng)然,不必把運(yùn)行應(yīng)用程序所需要的所有信息都安裝到一個(gè)地方??梢跃帉?xiě)一

12、些代碼,執(zhí)行多個(gè)應(yīng)用程序所要求的任務(wù)。此時(shí),通常把這些可重用的代碼放在所有應(yīng)用程序都可以訪問(wèn)的地方。在.NET Framework中,這個(gè)地方是全局程序集高速緩存(Global Assembly Cache,GAC</p><p>  6. 托管代碼在把代碼編譯為MSIL,再用JIT編譯器把它編譯為本機(jī)代碼后,CLR的任務(wù)還沒(méi)有全部完成。用.NET Framework編寫(xiě)的代碼在執(zhí)行(這個(gè)階段通常稱為運(yùn)行時(shí)(ru

13、ntime))時(shí)是托管的。即CLR管理著應(yīng)用程序,其方式是管理內(nèi)存、處理安全性,以及允許進(jìn)行跨語(yǔ)言調(diào)試等。相反,不在CLR控制之下運(yùn)行的應(yīng)用程序是非托管的,某些語(yǔ)言如C++可以用于編寫(xiě)這類應(yīng)用程序,例如,訪問(wèn)操作系統(tǒng)的低級(jí)功能。但是,在C#中,只能編寫(xiě)在托管環(huán)境下運(yùn)行的代碼。我們將使用CLR的托管功能,讓.NET自己與操作系統(tǒng)進(jìn)行交互。</p><p>  7. 垃圾回收 托管代碼最重要的一個(gè)功能是垃圾回收(ga

14、rbage collection)。這種.NET方法可確保應(yīng)用程序不再使用某些內(nèi)存時(shí),這些內(nèi)存就會(huì)被完全釋放。在.NET推出以前,這項(xiàng)工作主要由程序員負(fù)責(zé),代碼中的幾個(gè)簡(jiǎn)單錯(cuò)誤會(huì)把大塊內(nèi)存分配到錯(cuò)誤的地方,使這些內(nèi)存神秘失蹤。這通常意味著計(jì)算機(jī)的速度逐漸減慢,最終導(dǎo)致系統(tǒng)崩潰。 .NET垃圾回收會(huì)頻繁檢查計(jì)算機(jī)內(nèi)存,從中刪除不再需要的內(nèi)容。它沒(méi)有設(shè)置時(shí)間幀,可能一秒鐘內(nèi)會(huì)進(jìn)行上千次的檢查,也可能幾秒鐘檢查一次,或者隨時(shí)進(jìn)行檢查,但可以肯

15、定進(jìn)行了檢查。 這里要給程序員一些提示。因?yàn)檫@項(xiàng)工作在不可預(yù)知的時(shí)間進(jìn)行,所以在設(shè)計(jì)應(yīng)用程序時(shí),必須記得要進(jìn)行這樣的檢查。需要許多內(nèi)存才能運(yùn)行的代碼應(yīng)自己執(zhí)行這樣的檢查,而不是坐等垃圾回收,但這不像聽(tīng)起來(lái)那樣難。</p><p>  8. 把它們組合在一起 在繼續(xù)學(xué)習(xí)之前,先總結(jié)一下上述創(chuàng)建.NET應(yīng)用程序所需要的步驟:(1)使用某種.NET兼容語(yǔ)言(如C#)編寫(xiě)應(yīng)用程序代碼,如圖1-1所示。 (2)把代碼編譯為

16、MSIL,存儲(chǔ)在程序集中. (3) 在執(zhí)行代碼時(shí)(如果這是一個(gè)可執(zhí)行文件,就自動(dòng)運(yùn)行,或者在其他代碼使用它時(shí)運(yùn)行),首先必須使用JIT編譯器將代碼編譯為本機(jī)代碼,如圖1-3所示。(4)在托管的CLR環(huán)境下運(yùn)行本機(jī)代碼,以及其他應(yīng)用程序或過(guò)程.</p><p>  9. 鏈接在上述過(guò)程中還有一點(diǎn)要注意。在第(2)步中編譯為MSIL的C#代碼不一定包含在單獨(dú)的文件中,可以把應(yīng)用程序代碼放在多個(gè)源代碼文件中,再把它們編

17、譯到一個(gè)程序集中。這個(gè)過(guò)程稱為鏈接,是非常有用的。原因是處理幾個(gè)較小的文件比處理一個(gè)大文件要簡(jiǎn)單得多??梢园堰壿嬌舷嚓P(guān)的代碼分解到一個(gè)文件中,以便單獨(dú)處理它,這也更易于在需要代碼時(shí)找到它們,讓開(kāi)發(fā)小組把編程工作分解為可管理的塊,讓每個(gè)人編寫(xiě)一小塊代碼,而不會(huì)破壞已編寫(xiě)好的代碼部分或其他人正在處理的部分。</p><p>  .NET Framework Introduce</p><p>

18、  Alex Kriegel</p><p>  1.NET Framework for the development of Microsoft applications and the creation of a rich a revolutionary new platform. This case is most interesting is its vague, but this is a reason

19、 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

20、 system president, but future operations will be launched in other versions of the operating systems, such </p><p>  2.NET Framework mainly contains a very large code library. customers in languages (such as

21、 C #) through object-oriented programming (OOP) to use these codes. The library is divided into different modules, thus can expect the result to choose to use the various parts. For example, a module includes Windows app

22、lication 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-mod</p><p>  3. How

23、to use. NET Framework applications development. Use. NET Framework preparation of applications, is used. NET code for the preparation of code (using the Framework support any language). VS is a powerful integrated develo

24、pment environment, support for C # (and managed and unmanaged C + +. Visual Basic and other languages). The environmental advantages of the facilitates. NET to integrate the functions of the code. We build the code is C

25、# code, but use. NET Framework, and, if necessary, th</p><p>  4. Keyword and the JIT compiler in use. NET Framework library code, instead of immediately creating an operating system specific code of the mac

26、hine, but put code compiler for Microsoft intermediate language (Microsoft Intermedi ate Language, keyword) code, the code is not exclusive to any one operating system. not exclusive to C #. Other. NET language, If Visua

27、l Basic. NET can be compiled in the first stage of this language, When using VS C # application development, build on the process comple</p><p>  5. Program Set compiled application, citing the keyword code

28、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 li

29、brary (expansion are. dll). In addition to 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&

30、lt;/p><p>  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 prepared by the implementation of the code (often re

31、ferred 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 C

32、LR running under control of non-custody procedures, some languages such as C + + c</p><p>  7. Garbage collector managed one of the most important functions of the garbage collector (garbage collectio n). Th

33、is species. NET will ensure that applications would no longer use certain memory, the memory which will be completely released. In. NET introduced to the former, this primarily by programmers responsible, code of a few s

34、imple 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 comput</p><p>  8. The combination of them in co

35、ntinuous 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 c

36、entralized procedure, as shown in Figure 1-2. (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 co

37、de, as shown in Figure 1-3. </p><p>  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 cod

38、e on a number of source documents, and then compile them into a centralized procedure. This process is known as link is very useful. The reason is handling several smaller than handling paper documents to a much more sim

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 眾賞文庫(kù)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論