声明性元数据。
内联 XML 文档注释。
在 C 中,如果需要与其他 Windows 软件(如 COM 对象或本机 Win32 DLL)交互,可以通过一个称为“Interop”的过程来实现。
互操作使 C 程序能够完成本机 C 应用程序可以完成的几乎任何任务。
在直接内存访问必不可少的情况下,C 甚至支持指针和“不安全”代码的概念。
C 的生成过程比 C 和 C 简单,比 Java 更为灵活。
没有单独的头文件,也不要求按照特定顺序声明方法和类型。
C 源文件可以定义任意数量的类、结构、接口和事件。
C 程序在 .NET Framework 上运行,它是 Windows 的一个必要组件,包括一个称为公共语言运行时 CLR 的虚拟执行系统和一组统一的类库。
CLR 是Microsoft 的公共语言基础结构 CLI 的一个商业实现。
CLI 是一种国际标准,是用于创建语言和库在其中无缝协同工作的执行和开发环境的基础。
用 C 编写的源代码被编译为一种符合 CLI 规范的中间语言 IL。
IL 代码与资源(如位图和字符串)一起作为一种称为程序集的可执行文件存储在磁盘上,通常具有的扩展名为 .exe 或 .dll。
程序集包含清单,它提供关于程序集的类型、版本、区域性和安全要求等信息。
执行 C 程序时,程序集将加载到 CLR 中,这可能会根据清单中的信息执行不同的操作。
然后,如果符合安全要求,CLR 执行实时 JIT 编译以将 IL 代码转换为本机机器指令。
CLR 还提供与自动垃圾回收、异常处理和资源管理有关的其他服务。
由 CLR 执行的代码有时称为“托管代码”,它与编译为面向特定系统的本机机器语言的“非托管代码”相对应。
下图演示了 C 源代码文件、基类库、程序集和 CLR 的编译时与运行时的关系。
语言互操作性是 .NET Framework 的一个关键功能。
因为由 C 编译器生成的IL 代码符合公共类型规范 CTS,因此从 C 生成的 IL 代码可以与从 VisualBasic、Visual C、Visual J 的 .NET 版本或者其他 20 多种符合 CTS 的语言中的任何一种生成的代码进行交互。
单一程序集可能包含用不同 .NET 语言编写的多个模块,并且类型可以相互引用,就像它们是用同一种语言编写的。
除了运行时服务,.NET Framework 还包含一个由 4000 多个类组成的内容详尽的库,这些类被组织为命名空间, 到 为从文件输入和输出到字符串操作、 XML 分析、到 Windows 窗体控件的所有内容提供多种有用的功能。
典型的 C 应用程序使用 .NET Framework 类库广泛地处理常见的“日常”任务。
附件 2:外文原文 ASP.NET Overview ASP.NET is a unified Web development model that includes the servicesnecessary for you to build enterprise-class Web applications with a minimum ofcoding. ASP.NET is part of the .NET Framework and when coding ASP.NETapplications you have
access to classes in the .NET Framework. You can code yourapplications in any language compatible with the common language runtime CLRincluding Microsoft Visual Basic C JScript .NET and J. These languages enableyou to develop ASP.NET applications that benefit from the common languageruntime type safety inheritance and so on.ASP.NET includes: A page and controls framework The ASP.NET compiler Security infrastructure State-management facilities Application configuration Health monitoring and performance features Debugging support An XML Web services framework Extensible hosting environment and application life cycle management An extensible designer environment The ASP.NET page and controls framework is a programming framework thatruns on a Web server to dynamically produce and render ASP.NET Web pages.ASP.NET Web pages can be requested from any browser or client device andASP.NET renders markup such as HTML to the requesting browser. As a rule youcan use the same page for multiple browsers because ASP.NET renders theappropriate markup for the browser making the request. However you can designyour ASP.NET Web page to target a specific browser such as Microsoft InternetExplorer 6 and take advantage of the features of that browser. ASP.NET supportsmobile controls for Web-enabled devices such as cellular phones handheld computersand personal digital assistants PDAs. ASP.NET Web pages are completely object-oriented. Within ASP.NET Webpages you can work with HTML elements using properties methods and events. TheASP.NET page framework removes the implementation details of the separation ofclient and server inherent in Web-based applications by presenting a unified model forresponding to client events in code that runs at the server. The framework alsoautomatically maintains the state of a page and the controls on that page during thepage processing life cycle. The ASP.NET page and controls framework also enables you to encapsulatecommon UI functionality in easy-to-use reusable controls. Controls are written oncecan be used in many pages and are integrated into the ASP.NET Web page that theyare placed in during rendering. The ASP.NET page and controls framework also provides features to control theoverall look and feel of your Web site via themes and skins. You can define themesand skins and then apply them at a page level or at a control level. In addition to themes you can define master pages that you use to create aconsistent layout for the pages in your application. A single master page defines thelayout and standard behavior that you want for all the pages or a group of pages inyour application. You can then create individual content pages that contain thepage-specific content you want to display. When users request the content pages theymerge with the master page to produce output that combines the layout of the masterpage with the content from the content page. All ASP.NET code is compiled which enables strong typing performanceoptimizations and early binding among other benefits. Once the code has beencompiled the common language runtime further compiles ASP.NET code to nativecode providing improved performance. ASP.NET includes a compiler that will compile all your application componentsincluding pages and controls into an assembly that the ASP.NET hosting environmentcan then use to service user requests. In addition to the security features of .NET ASP.NET provides an advancedsecurity infrastructure for authenticating and authorizing user
access as well asperforming other security-related tasks. You can authenticate users using Windowsauthentication supplied by IIS or you can manage authentication using your own userdatabase using ASP.NET forms authentication and ASP.NET membership.Additionally you can manage the authorization to the capabilities and information ofyour Web application using Windows groups or your own custom role database usingASP.NET roles. You can easily remove add to or replace these schemes dependingupon the needs of your application. ASP.NET always runs with a particular Windows identity so you can secureyour application using Windows capabilities such as NTFS
Access Control ListsACLs database permissions and so on. For more information on the identity ofASP.NET ASP.NET provides intrinsic state management functionality that enables you tostore information between page requests such as customer information or the contentsof a shopping cart. You can save and manage application-specific session-specificpage-specific user-specific and developer-defined information. This information canbe independent of any controls on the page. ASP.NET offers distributed state facilities which enable you to manage stateinformation across multiple instances of the same application on one computer or onseveral computers. ASP.NET applications use a configuration system that enables you to defineconfiguration settings for your Web server for a Web site or for individualapplications. You can make configuration settings at the time your ASP.NETapplications are deployed and can add or revise configuration settings at any timewith minimal impact on operational Web applications and servers. ASP.NETconfiguration settings are stored in XML-based files. Because these XML files areASCII text files it is simple to make configuration changes to your Web applications.You can extend the configuration scheme to suit your requirements. ASP.NET includes features that enable you to monitor health and performance ofyour ASP.NET application. ASP.NET health monitoring enables reporting of keyevents that provide information about the health of an application and about errorconditions. These events show a combination of diagnostics and monitoringcharacteristics and offer a high degree of flexibility in terms of what is logged andhow it is logged.ASP.NET supports two groups of performance counters accessible to yourapplications: The ASP.NET system performance counter group The ASP.NET application performance counter group ASP.NET takes advantage of the run-time debugging infrastructure to providecross-language and cross-computer debugging support. You can debug both managedand unmanaged objects as well as all languages supported by the common languageruntime and script languages. In addition the ASP.NET page framework provides a trace mode that enablesyou to insert instrumentation messages into your ASP.NET Web pages. ASP.NET supports XML Web services. An XML Web service is a componentcontaining business functionality that enables applications to exchange informationacross firewalls using standards like HTTP and XML messaging. XML Web servicesare not tied to a particular component technology or object-calling convention. As aresult programs written in any language using any component model and running onany operating system can
access XML Web services. ASP.NET includes an extensible hosting environment that controls the life cycleof an application from when a user first accesses a resource such as a page in theapplication to the point at which the application is shut down. While ASP.