计算机英文文献及翻译+.net_第1页
计算机英文文献及翻译+.net_第2页
计算机英文文献及翻译+.net_第3页
计算机英文文献及翻译+.net_第4页
计算机英文文献及翻译+.net_第5页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、c# 语法表现力强, 而且简单易学。 c# 的大括号语法使任何熟悉c、c+ 或java 的人都可以立即上手。 了解上述任何一种语言的开发人员通常在很短的时间内就可以开始使用c# 高效地进行工作。 c# 语法简化了c+ 的诸多复杂性,并提供了很多强大的功能, 例如可为null 的值类型、 枚举、委托、lambda 表达式和直接内存访问,这些都是java 所不具备的。 c# 支持泛型方法和类型,从而提供了更出色的类型安全和性能。c# 还提供了迭代器, 允许集合类的实施者定义自定义的迭代行为,以便容易被客户端代码使用。在c# 3.0 中,语言集成查询(linq) 表达式使强类型查询成为了一流的语言构

2、造。作为一种面向对象的语言,c# 支持封装、 继承和多态性的概念。 所有的变量和方法,包括main方法(应用程序的入口点),都封装在类定义中。类可能直接从一个父类继承, 但它可以实现任意数量的接口。重写父类中的虚方法的各种方法要求override关键字作为一种避免意外重定义的方式。在c# 中,结构类似于一个轻量类; 它是一种堆栈分配的类型, 可以实现接口, 但不支持继承。除了这些基本的面向对象的原理之外, c# 还通过几种创新的语言构造简化了软件组件的开发,这些结构包括:封装的方法签名(称为 “ 委托” ),它实现了类型安全的事件通知。属性 (property),充当私有成员变量的访问器。属性

3、 (attribute),提供关于运行时类型的声明性元数据。内联 xml 文档注释。语言集成查询(linq) ,提供了跨各种数据源的内置查询功能。在c# 中,如果必须与其他windows 软件(如com 对象或本机 win32 dll)交互,则可以通过一个称为“ 互操作 ” 的过程来实现。互操作使c# 程序能够完成本机c+ 应用程序可以完成的几乎任何任务。在直接内存访问必不可少的情况下, c# 甚至支持指针和 “ 不安全 ” 代码的概念。c# 的生成过程比c 和 c+ 简单,比 java 更为灵活。没有单独的头文件,也不要求按照特定顺序声明方法和类型。c# 源文件可以定义任意数量的类、结构、接

4、口和事件。下列各项是其他c# 资源:有关该语言的充分常规介绍,请参见c# 语言规范 的第 1 章。有关c# 语言特定方面的详细信息,请参见c# 参考。有关c# 语法与java 和c+ 语法的比较,请参见c# 编程语言(针对 java 开发人员) 和 c# (针对 c+ 开发人员) 。有关 linq 的更多信息,请参见语言集成查询(linq) 。若要查找visual c# 团队提供的最新文章和资源,请访问visual c# 开发中心 。 .net framework 平台体系结构c# 程序在 .net framework 上运行,它是 windows 的一个不可或缺的组件,包括一个称为公共语言运

5、行库(clr) 的虚拟执行系统和一组统一的类库。clr 是 microsoft 的公共语言基础结构(cli) 的商业实现。 cli 是一种国际标准,是用于创建语言和库在其中无缝协同工作的执行和开发环境的基础。用c# 编写的源代码被编译为一种符合cli 规范的中间语言(il)。il 代码与资源 (例如位图和字符串) 一起作为一种称为程序集的可执行文件存储在磁盘上,通常具有的扩展名为 .exe 或 .dll 。程序集包含清单,它提供有关程序集的类型、版本、区域性和安全要求等信息。执行c# 程序时,程序集将加载到clr 中,这可能会根据清单中的信息执行不同的操作。然后,如果符合安全要求, clr 就

6、会执行实时(jit) 编译以将il 代码转换为本机机器指令。clr 还提供与自动垃圾回收、异常处理和资源管理有关的其他服务。 由 clr 执行的代码有时称为 “ 托管代码 ” ,它与编译为面向特定系统的本机机器语言的“ 非托管代码 ” 相对应。下图阐释了c# 源代码文件、.net framework 类库、程序集和clr 的编译时与运行时的关系。语言互操作性是 .net framework 的一项主要功能。 因为由 c# 编译器生成的 il 代码符合公共类型规范(cts) ,因此从c# 生成的 il 代码可以与从visual basic、visual c+、visual j# 的 .net 版

7、本或者其他20 多种符合 cts 的语言中的任何一种生成的代码进行交互。单一程序集可能包含用不同 .net 语言编写的多个模块,并且类型可以相互引用,就像它们是用同一种语言编写的。除了运行时服务之外, .net framework 还包含一个由4000 多个类组成的内容详尽的库,这些类被组织为命名空间,为从文件输入和输出、字符串操作、xml 分析到 windows 窗体控件的所有内容提供了各种有用的功能。典型的c# 应用程序使用 .net framework 类库广泛地处理常见的 “ 日常” 任务。# syntax is highly expressive, yet it is also si

8、mple and easy to learn. the curly-brace syntax of c# will be instantly recognizable to anyone familiar with c, c+ or java. developers who know any of these languages are typically able to begin to work productively in c# within a very short time. c# syntax simplifies many of the complexities of c+ a

9、nd provides powerful features such as nullable value types, enumerations, delegates, lambda expressions and direct memory access, which are not found in java. c# supports generic methods and types, which provide increased type safety and performance, and iterators, which enable implementers of colle

10、ction classes to define custom iteration behaviors that are simple to use by client code. in c# 3.0, language-integrated query (linq) expressions make the strongly-typed query a first-class language construct. as an object-oriented language, c# supports the concepts of encapsulation, inheritance, an

11、d polymorphism. all variables and methods, including the main method, the applications entry point, are encapsulated within class definitions. a class may inherit directly from one parent class, but it may implement any number of interfaces. methods that override virtual methods in a parent class re

12、quire the override keyword as a way to avoid accidental redefinition. in c#, a struct is like a lightweight class; it is a stack-allocated type that can implement interfaces but does not support inheritance. in addition to these basic object-oriented principles, c# makes it easy to develop software

13、components through several innovative language constructs, including the following: encapsulated method signatures called delegates , which enable type-safe event notifications. properties, which serve as accessors for private member variables. attributes, which provide declarative metadata about ty

14、pes at run time. inline xml documentation comments. language-integrated query (linq) which provides built-in query capabilities across a variety of data sources. if you have to interact with other windows software such as com objects or native win32 dlls, you can do this in c# through a process call

15、ed interop. interop enables c# programs to do almost 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 compared to c and c+ and more flexible than

16、 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. the following are additional c# resources: for a good general introduction to the language, s

17、ee chapter 1 of the c# language specification. for detailed information about specific aspects of the c# language, see the c# reference. for a comparison of c# syntax to java and c+, see the c# programming language for java developers and c# for c+ developers. for more information about linq, see la

18、nguage-integrated query (linq). to find the latest articles and resources from the visual c# team, see the visual c# developer center. .net framework platform architecture c# programs run on the .net framework, an integral component of windows that includes a virtual execution system called the comm

19、on language runtime (clr) and a unified set of class libraries. the clr is the commercial implementation by microsoft of the common language infrastructure (cli), an international standard that is the basis for creating execution and development environments in which languages and libraries work tog

20、ether seamlessly. source code written in c# is compiled into an intermediate language (il) that conforms to the cli specification. the il code and resources, such as bitmaps and strings, are stored on disk in an executable file called an assembly, typically with an extension of .exe or .dll. an asse

21、mbly contains a manifest that provides information about the assemblys types, version, culture, and security requirements. when the c# program is executed, the assembly is loaded into the clr, which might take various actions based on the information in the manifest. then, if the security requiremen

22、ts are met, the clr performs just in time (jit) compilation to convert the il code to native machine instructions. the clr also provides other services related to automatic garbage collection, exception handling, and resource management. code that is executed by the clr is sometimes referred to as m

23、anaged code, in contrast to unmanaged code which is compiled into native machine language that targets a specific system. the following diagram illustrates the compile-time and run-time relationships of c# source code files, the .net framework class libraries, assemblies, and the clr. language interoperability is a key feature of the .net framework. because the il code produced by the c# compiler conforms to the common type specifi

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论