【正文】
r anything other than XML, and this degree of specialization would feel out of place in C. Managed Code The .NET Framework provides more than just a class library. It also provides services in subtler ways that are not accessed explicitly through library calls. For example, earlier we mentioned that C can automate some aspects of memory management, a notorious source of bugs in C++ code. Abandoning heapallocated objects once you’re done with them is a coding error in C++, but it’s the normal way to free them in .NET. This service is provided by the CLRthe .NET Framework’s runtime environment. Although the C piler works closely with the runtime to make this possible, providing the necessary information about how your code uses objects and data, it’s ultimately the runtime that does the work of garbage collection. Depending on what sorts of languages you may have worked with before, the idea that the language depends heavily on the runtime might seem either pletely natural or somewhat disconcerting. It’s certainly different from how C and C++ workwith those languages, the piler’s output can be executed directly by the puter, and although those languages have some runtime services, it’s possible to write code that can run without them. But C code cannot even execute without the help of the runtime. Code that depends entirely on the runtime is called managed code. Managed pilers do not produce raw executable code. Instead, they produce an intermediate form of code called IL, the Intermediate Language. The runtime decides exactly how to convert it into something executable. One practical upshot of managed code is that a piled C program can run on both 32bit and 64bit systems without modification, and can even run on different processor architecturesit’s often possible for code that runs on an ARMbased handheld device to run unmodified on Intelbased PCs, or on the PowerPC architecture found in the Xbox 360 game console. As interesting as CPU independence may be, in practice the most useful aspect of managed code and IL is that the .NET runtime can provide useful services that are very hard for traditional pilation systems to implement well. In other words, the point is to make developers more productive. The memory management mentioned earlier is just one example. Others include a security model that takes the origin of code into account rather than merely the identity of the user who happens to be running the code。 dynamic docProperties = 。 原因很不讓人愉快因為辦公編程模型是為動態(tài)語言而設(shè)計的,為了能在運行的時候填補很多細(xì)節(jié)。 Type docPropType = ()。 話雖這么說,一個主題團結(jié)在第 4 版的新的語言特性:它們支持動態(tài)規(guī)劃,特別注重了對某些互操作性方案簡單。 Java 使得前不成比例比后者更難。然而,如果你需要使用一個第三方組件或功能的操作系統(tǒng)目前還沒有。 連續(xù)性和 windows 生態(tài)系統(tǒng) 沒有成功的軟件開發(fā)平臺純粹是對自己的優(yōu)點上下文事項。其他包括安全模型,考慮到代碼的起源而不是僅僅發(fā)生運行代碼的用戶的身份 。 托管編譯器不產(chǎn)生原始的可執(zhí)行代碼。 NET 編碼錯誤。 這一理念的一個 突出的例子就是在 C中證明原型的一個功能,但最終剩下的只有:XML 文本。 從表面上看,這似乎添加類似 SQL 的查詢語言功能,提供了一個自然的方式融入你的代碼數(shù)據(jù)庫訪問。擅長復(fù)雜的計算和算法,有一些特點,可以幫助并行執(zhí)行。它是原生 的 。與C++相比,它支持原始語言的 .NET 的擴展。同樣,框架通常需要整合與相關(guān)服務(wù)為例,雖然在一定程度上的 Windows 窗體 UI 框架有其自身獨特的 API,很多的基本功能是所提供的 Win32 組件。“ Hello, world” 示例 class Program { static void Main(){ (Hello, world)。 C是為 .NET 設(shè)計的,他們之間關(guān)系如此密切的一個主要好處是與框架功能的合作,就像類庫一樣感覺很自然?;菊Z言元素如語句、表達(dá)式、函數(shù)聲明和流量控制,盡量與 C 家族語言接近。因此,在本章中,我們將要了解 C建立一個什么樣的問題解決機制。 08 屆本科畢業(yè)設(shè)計 (論文 )外文 文獻(xiàn)翻譯 學(xué) 院: 計算機科學(xué)與工程學(xué)院 專 業(yè): 網(wǎng)絡(luò)工程 姓 名: XX XX 學(xué) 號: 090208205 外文出處: Programming C 附 件: ; 。因此,我們將探討這種語言的風(fēng)格,并且通過各個方面來區(qū)別 C與其他語言。 當(dāng)然,一個熟悉的語法這個理由并不足夠來選擇一個語法,所以 C提供了一個生產(chǎn)增強特性,這個特性在它之前的語言中并沒有。 .NET Framwork 類庫 在 C中工作是指比語言用到的更多 —— .NET Framwork 提供的類是開發(fā)人員日常經(jīng)驗(他們占了這本書很大一部分內(nèi)容)的一個極其重要的組成部分。 } } 我們將在適當(dāng)?shù)臅r 候檢查所有組件,但現(xiàn)在,即使是這個最簡單的例子也需要調(diào)用庫中的類(這個例子中的 類)來做這個工作。因此,這里的三個類別是不嚴(yán)格。 擴展是經(jīng)過深思熟慮 的并且工作的很好 , 但是所調(diào)用 .NET 庫的代碼與 C++并不相同。 NET 語言像 VB 的語法,而不是 VB 6 中。然而,與許多 語言功能,使一些困難的問題更容易的成本是很多在更傳統(tǒng)的語言很容易的事情是有顯著努力,在 F# 功能性語言,善于在復(fù)雜的問題,但可以用簡單的笨拙的。例 12 顯示了一個簡單查詢 的功能 。這一個實驗的語法允許內(nèi)嵌 XML,用編譯成代碼,建立模型來來表該 XML的方法。這 CLR 的。相反,它們產(chǎn)生中間形式的代碼稱為白細(xì)胞介素,中間語言運行時決定。靈活裝載了強大的支持服務(wù)和版本的共享組件的機制 。例如,第三方組件和工具 的廣泛可用性平臺明顯 更具吸引力。 NET 包裝,工作能力等非托管功能直接從托管代碼是無價的。 最新版本的 C#包含的功能,提高能力,進一步。例如,可以考慮在示例 13 C# 的代碼,使用部分 Office對象模型讀取 Word 文檔的作者屬性。 object authorProp = (Item, | ,null, docProperties,new object[] { Author })。 C# 中 并 不能夠做到這一點,所以開發(fā)商 不得不手動做這些所有的工作 。 string authorName = docProperties[Author].Value。 flexible mechanisms for loading shared ponents with robust support for servicing and versioning。 Type docPropType = ()。 doc = (, ReadOnly: true)。 string authorName = docProperties[Author].Value。 Type propType = ()。 and as already mentioned, the CLR’s ability to verify that code conforms to type safety rules before executing it, ruling out whole classes of security and stability bugs. If you’re a Java developer, all of this will sound rather familiar— just substitute bytecode for IL and the story is very similar. Indeed, a popular but somewhat ignorant “joke” among the less thoughtful members of the Java munity is to describe C as a poor imitation of Java. When the first version of C appeared, the differences were subtle, but the fact that Java went on to copy several features from C illustrates that C was always more than a mere clone. The languages have grown more obviously different with each new version, but one difference, present from the start, is particularly important for Windows developers: C has always made it easy to get at the features of the underlying Windows platform. Continuity and the Windows Ecosyst