【正文】
除了運(yùn)行時服務(wù), .NET Framework 還包含一個由 4000 多個類組成的內(nèi)容詳盡的庫,這些類被組織為命名空間,為從文件輸入和輸出到字符串操作、到 XML 分析、到 Windows 窗體控件的所有內(nèi)容提供多種有用的功能。沒有單獨(dú)的頭文件,也不要求按照特定順序聲明方法和類型。 C 語法簡化了 C++ 的諸多復(fù)雜性,同時提供了很多強(qiáng)大的功能,例如可為空的值類型、枚舉、委托、匿名方法和直接內(nèi)存訪問,這些都是 Java 所不具備的。 此外, 頁框架提供使您可以將檢測消息插入 網(wǎng)頁的跟蹤模式。您可以根據(jù)應(yīng)用程序的需要方便地移除、添加或替換這些方案。該框架還會在頁處理生命周期中自動維護(hù)頁及該頁上控件的狀態(tài)。當(dāng)您編寫 應(yīng)用程序的代碼時,可以訪問 .NET Framework 中的類??梢韵榷x主題和外觀,然后 在頁面級或控件級應(yīng)用這些主題和外觀。 提供了分布式狀態(tài)功能,使您能夠管理一臺計(jì)算機(jī)或數(shù)臺計(jì)算機(jī)上同一應(yīng)用程序的多個實(shí)例的狀態(tài)信息。 包括一個可擴(kuò)展的宿主環(huán)境,該環(huán)境控制應(yīng)用程序的生命周期,即從用戶首次訪問此應(yīng)用程序中的資源(例如頁)到應(yīng)用程序關(guān)閉這一期間。類可能直 5 接從一個父類繼承,但它可以實(shí)現(xiàn)任意數(shù)量的接口。 用 C 編寫的源代碼被編譯為一種符合 CLI 規(guī)范的中間語言 (IL)。 it is a stackallocated type that can implement interfaces but does not support inheritance. In addition to these basic objectoriented principles, C facilitates the development of software ponents through several innovative language constructs, including: ? Encapsulated method signatures called delegates, which enable typesafe event notifications. ? Properties, which serve as accessors for private member variables. ? Attributes, which provide declarative metadata about types at run time. ? Inline XML documentation ments. If you need to interact with other Windows software such as COM objects or native Win32 DLLs, you can do this in C through a process called Interop. Interop 13 enables C programs to do just about anything that a native C++ application can do. C even supports pointers and the concept of unsafe code for those cases in which direct memory access is absolutely critical. The C build process is simple pared to C and C++ and more flexible than in Java. There are no separate header files, and no requirement that methods and types be declared in a particular order. A C source file may define any number of classes, structs, interfaces, and events. C programs run on the .NET Framework, an integral ponent of Windows that includes a virtual execution system called the mon language runtime (CLR) and a unified set of class libraries. The CLR is Microsoft39。由 CLR 執(zhí)行的代碼有時稱為 “ 托管代碼 ” ,它與編譯為面向特定系統(tǒng)的本機(jī)機(jī)器語言的 “ 非托管代碼 ” 相對應(yīng)。 ? 內(nèi)聯(lián) XML 文檔注釋。使用 C,您可以創(chuàng)建傳統(tǒng)的 Windows 客戶端應(yīng)用程序、 XML Web services、分布式組件、客戶端 服務(wù)器應(yīng)用程序、數(shù)據(jù)庫應(yīng)用程序以及很多其他類型的程序。 包括可監(jiān)視 應(yīng)用程序的運(yùn)行狀況和性能的功能。代碼一經(jīng)編譯,公共語言運(yùn)行庫會進(jìn)一步將 編譯為本機(jī)代碼,從而提供增強(qiáng)的性能。但是,您可以針對諸如 Microsoft Inter Explorer 6 的特定瀏覽器設(shè)計(jì) 網(wǎng)頁,并利用該瀏覽器的功能。通常,您可以對多個瀏覽器使用相同的頁,因?yàn)? 會為發(fā)出請求的瀏覽器呈現(xiàn)適當(dāng)?shù)臉?biāo)記。 所有 代碼都經(jīng)過了編譯,可提供強(qiáng)類型、性能優(yōu)化和早期綁定以及其他優(yōu)點(diǎn)。您可以擴(kuò)展配置方案,使其符合自己的要求。 C 是一種簡潔、類型安全的面向?qū)ο蟮恼Z言,開發(fā)人員可以使用它來構(gòu)建在 .NET Framework 上運(yùn)行的各種安全、可靠的應(yīng)用程序。 ? 屬性 (Attribute),提供關(guān)于運(yùn)行時類型的聲明性元數(shù)據(jù)。 CLR 還提供與自動垃圾回收、異常處理和資源管理有關(guān) 6 的其他服務(wù)。s mercial implementation of the mon language infrastructure (CLI), an international standard that is the basis for creating execution and development environments in which languages and libraries work together seamlessly. Source code written in C is piled into an intermediate language (IL) that conforms to the CLI specification. The IL code, along with resources such as bitmaps and strings, is stored on disk in an executable file called an assembly, typically with an extension of .exe or .dll. An assembly contains a manifest that provides information on the assembly39。 IL 代碼與資源(如位圖和字符串)一起作為一種稱為程序集的可執(zhí)行文件存儲在磁盤上,通常具有的擴(kuò)展名為 .exe 或 .dll。重寫父類中的虛方法的各種方法要求 override 關(guān)鍵字作為一種避免意外重定義的方式。雖然 依賴作為應(yīng)用程序宿主的 Web 服務(wù)器 (IIS),但 自身也提供了許多宿主功能。 通過 應(yīng)用程序使用的配置系統(tǒng),可以定義 Web 服務(wù)器、網(wǎng)站或單個應(yīng)用程序的配置設(shè)置。 除了主題外,還可以定義母版頁,以使應(yīng)用程序中的頁具有一致的布局。您可以使用與公共語言運(yùn)行庫 (CLR) 兼容的任何語言來編寫應(yīng)用程序的代碼,這些語言包括 Microsoft Visual Basic、 C、 JScript .NET 和 J。 頁框架為響應(yīng)在 服務(wù)器上運(yùn)行的代碼中的客戶端事件提供統(tǒng)一的模型,從而使您不必考慮基于 Web 的應(yīng)用程序中固有的客戶端和服務(wù)器隔離的實(shí)現(xiàn)細(xì)節(jié)。此外,可以使用 Windows 組或您自 己的自定義角色數(shù)據(jù)庫(使用 角色)來管理 3 Web 應(yīng)用程序的功能和信息方面的授權(quán)??梢哉{(diào)試托管和非托管對象,以及公共語言運(yùn)行庫和腳本語言支持的所有語言。了解上述任何一種語言的開發(fā)人員通常在很短的時間內(nèi)就可以開始使用 C 高效地工作。 C 的生成過程比 C 和 C++ 簡單,比 Java 更為靈