您的当前位置:首页图书在线销售系统--外文翻译

图书在线销售系统--外文翻译

2020-03-27 来源:乌哈旅游
本科毕业设计(论文)外文翻译

译文: C#基础介绍 出自作者Anders Hejlsberg and Scott Wiltamuth C#是一种简单,现代,面向对象和类型安全的编程语言,由C和C++发展而来。C#牢固地植根于C和C++语言族谱种,并且会很快被C和C++程序员所熟悉。C#的目标在于把VISUAL BASIC的高生产力和C++本身的能力结合起来。 C#作为MICROSOFT Visual Studio 7.0的一部分提供给用户。除了C#以外,Visual Studio还支持Visual Basic,Visual++和描述语言Vbscript和Jscript.所有这些语言都提供对Microsoft.NET 平台的访问能力,它包括一个通用的执行引擎和一个丰富的类库。Microsoft.NET平台定义了一个“通用语言子集”(CLS),是一种混合语言,它可以增强CLS兼容语言和类库间的无缝协同工作能力。对于C#开发者,这意味着既是C#是一种新的语言,它已经可以对用老牌工具如Visual Basic和Visual C++使用的丰富类库进行完全访问。C#子集并没有包含一个类库。 一个C#程序由一个或多个源文件组成。一个源文件是一个统一字符编码的字符的有序序列。燕文件通常和文件系统种的文件有一一对应关系,但是这个对应关系并不需要。 从概念来讲,一个程序在编译时有四步: 1. 预处理,一种文本到文本的转换,这使得可以对程度需文本进行条件饱和和删除。 2. 语法分析,它把输入字符序列转换为一个标记序列。 3. 句法分析,它把标记序列转换为可执行代码。 C#的词汇和句子的文法散步在整个文章中。词汇文法定义如能把字符组合为形式标记:句子的文法定义了如何把标记组合为C#程序。 文法生成包括无词尾符号和有词尾符号。在文法生成当中,无词尾符号用意大利体表示,而有词尾符号用定宽字体。每一个吴词尾符号定义为一系列产品(PRODUCTION)。这一系列产品的第一行是吴词尾符号的名称,接下来是一个冒号。对于一个场频,每个连续的锯齿状的行的右手边同左手边类似是无词尾符号。 C#程序中的生命定义了程序的重要声明。C#程序用名称空间来组织,它可以包含类型声明和潜逃声明。类型声明用来定义类,结构,接口,类的声明可以包含实例构造函数,析构函数,静态构造函数,常数,域,方法,属性,时间,索引,操1

本科毕业设计(论文)外文翻译

作符和潜逃类型。 一个声明在声明所属的声明域定义了一个名称。除了重载构造函数,方法,索引和操作符名称,在一个声明域种有两个或更多介绍有相同名称成员的声明时,是错误的。对一个而生命域中,包含有相同名称的不同种类成员是永远不可能的。例如,一个声明域种不能包括有相同名称的域和方法。这里有许多种不同类型的声明域,如下表示: 在所有程序的源文件种,不包括嵌套名称空间声明的名称空间成员声明都是一个单独的组合声明域,称为全局声明域。 在所有程序的源文件种,名称空间成员声明和有相同完整正确的名称空间名称的名称空间声明都是一个单独的组合声明域。 每个类,结构或接口声明都会创建一个新的声明域。名称通过类成员声明,结构成员什么或接口成员声明介绍到这个声明域中。除了重载构造函数声明和静态构造函数声明,一个类类或结构成员声明不能引入域类或结构名称相同的成员。一个类,节后或接口允许方法和所以的重载。此外,一个类声明的方法,而在他们各自签名中提供了不同的方法声明。注意基类不影响类的声明域。而基本接口不影响一个接口的声明域。这样,一个派生的类或接口可以用和继承的成员相同的名称声明一个成员。这样的一个成员贝成为隐藏了继承的成员。 每个枚举声明创建一个新的声明域。名称通过枚举成员声明介绍到声明域中。 每个块或者转换为局部变量创建一个分立声明域。名称通过局部变量声明贝引入到这个声明域。如果一个块是构造函数或方法声明的主体,在形参列表中声明的参数是这2个块的局部变量声明域的成员。块的局部变量声明域包括任何嵌套块。因而,在一个嵌套块中不太可能用域嵌套块中的局部变量有相同名称声明一个局部变量 每个块或转换块为标签创建一个分立的声明域。名称通过标签声明贝引入到这个声明域,而名称通过GOTO声明引入到这2个声明域。块的局部变量声明域包括任何嵌套块。因而,在一个嵌套块中不太可能用域嵌套块中的标签想同名称声明一个标签。 在名称贝声明的文本顺序通常并不重要。特别是,文本顺序对于声明和使用名称空间,类型,常数,方法,属性,时间,索引,操作符,构造函数,析构函数和静态构造函数来说并不重要。声明顺序在下面的途径才是重要的: ·域声明和局部变量的声明顺序决定了他们的初始化是按声明顺序执行。 ·局部变量必须在他们被使用前定义。 ·当常数表达式数值贝忽略,枚举成员的声明顺序是重要的。 C#语言的类型被分为三类:数值类型,引用类型和指针类型。 2

本科毕业设计(论文)外文翻译

TYPE: VALUE-TYPE REFERENCE-TYPE POINTER-TYPE 指针类型只能用在不安全代码。 数值类型与引用类型所不同的是,数值类型变量直接含有他们的数据,然而引用类型的变量存储对他们的数据的引用,就是后面要接受的对象。独语引用类型,可能会出现两个变量引用相同对象的情况,这样对于一个变量的操作就有可能影响到由其他变量引用的对象。对于数值类型,每个变量都有他们自己对数据的拷贝,这样就不能能出现一个对变量的操作影响到另外一个的情况。 C#的类型系统是统一的,这样任何类型的数据都可以贝看作对象。C#中的任何类型都直接或简介地从BOJIECT类类型派生,而OBJECT是所有类型的最基本类。引用类型的数值贝看作通过对象,这些对象通过把数值看作类型对象来简化。数值类型的数值通过包装和解包装操作来贝当作对象。 变量代表数据的实际存储位置。每各变量所能存储的数值由它本省的类型决定。C++语言是一种类项安全语言(TSL),而且C++编译器保证每一个数值贝保存在相应的变量中。变量的数值可以通过赋值或者++或-运算符改变。 在变量贝赋值以前,变量自身的类型必须贝明确的声明。 变量或者贝初始化的或者未初始化的。一个初始化的变量在贝定义时贝赋予了一个确定的初始值,而未初始化的变量在定义时并未贝赋予确定的初始值。对于一个在程序某处贝认为具有确定数值的IUA,必然在指向这一位置的所有可能的执行路径上存在赋值操作。 C#语言的大多数都使得程序员可以制定关于在程序中定义的实体的公开的消息。例如,一个类中的一个方法的可访问性,可以通过用方法修饰符PUBLIC,PROTECTED,INTERNAL和PRIVATE对它进行修饰来制定。 C#使得程序员可以创造声明信息的新的种类,来为各种程序实体指定声明信息,并且在运行时环境中找回属性信息。例如,一个框架也许定义了一个HELPATTRIBUTE属性,它可以被放在例如类和方法的程序元素种类来提供从程序元素到他们的文档的映射。 声明信息的新种类通过属性类的声明来定义,它可能有位置的和名称的参数。声明信息使用属性来指定C#程序,并且可以在运行是作为属性实例来检索。 3

本科毕业设计(论文)外文翻译

原文: C# basic introduction From written by Anders Hejlsberg and Scott Wiltamuth C# is a simple, modern, object oriented, and type-safe programming language derived from C and C++. C# (pronounced “C sharp”) is firmly planted in the C and C++ family tree of languages, and will immediately be familiar to C and C++ programmers. C# aims to combine the high productivity of Visual Basic and the raw power of C++.Here I will introduce some important serise numbers to explain the C#. C# is provided as a part of Microsoft Visual Studio 7.0. In addition to C#, Visual Studio supports Visual Basic, Visual C++, and the scripting languages VBScript and JScript. All of these languages provide access to the Next Generation Windows Services (NWGS) platform, which includes a common execution engine and a rich class library. The .NET software development kit defines a \"Common Language Subset\" (CLS), a sort of lingua franca that ensures seamless interoperability between CLS-compliant languages and class libraries. For C# developers, this means that even though C# is a new language, it has complete access to the same rich class libraries that are used by seasoned tools such as Visual Basic and Visual C++. C# itself does not include a class library. A C# program consists of one or more source files. A source file is an ordered sequence of Unicode characters. Source files typically have a one-to-one correspondence with files in a file system, but this correspondence is not required by C#. Conceptually speaking, a program is compiled using four steps: Pre-processing, a text-to-text translation that enables conditional inclusion and exclusion of program text. Lexical analysis, which translates a stream of input characters into a stream of tokens. Syntactic analysis, which translates the stream of tokens into executable code. Lexical and syntactic grammars for C# are interspersed throughout this specification. The lexical grammar defines how characters can be combined to form tokens; the syntactic grammar defines how tokens can be combined to form C# programs. Grammar productions include non-terminal symbols and terminal symbols. In grammar productions, non-terminal symbols are shown in italic type, and terminal symbols are shown in a fixed-width font. Each non-terminal is defined by a set of productions. The first line of a set of productions is the name of the non-terminal, followed by a colon. Each successive indented line contains the right-hand side for a production that has the non-terminal symbol as the left-hand side. Declarations in a C# program define the constituent elements of the program. C# programs are organized using namespaces, which can contain type declarations and nested namespace declarations. Type declarations are used to define classes, structs, interfaces, enums, and delegates. The kinds of members permitted in a type declaration depends on the form of the type declaration. For instance, class declarations can contain declarations for instance constructors, destructors, static constructors, constants, fields, methods, properties, events, indexers, operators, and nested types. A declaration defines a name in the declaration space to which the declaration belongs. Except 4

本科毕业设计(论文)外文翻译

for overloaded constructor, method, indexer, and operator names, it is an error to have two or more declarations that introduce members with the same name in a declaration space. It is never possible for a declaration space to contain different kinds of members with the same name. For example, a declaration space can never contain a field and a method by the same name. There are several different types of declaration spaces, as described in the following. Within all source files of a program, namespace-member-declarations with no enclosing namespace-declaration are members of a single combined declaration space called the global declaration space. Within all source files of a program, namespace-member-declarations within namespace-declarations that have the same fully qualified namespace name are members of a single combined declaration space. Each class, struct, or interface declaration creates a new declaration space. Names are introduced into this declaration space through class-member-declarations, struct-member-declarations, or interface-member-declarations. Except for overloaded constructor declarations and static constructor declarations, a class or struct member declaration cannot introduce a member by the same name as the class or struct. A class, struct, or interface permits the declaration of overloaded methods and indexers. A class or struct furthermore permits the declaration of overloaded constructors and operators. For instance, a class, struct, or interface may contain multiple method declarations with the same name, provided these method declarations differ in their signature. Note that base classes do not contribute to the declaration space of a class, and base interfaces do not contribute to the declaration space of an interface. Thus, a derived class or interface is allowed to declare a member with the same name as an inherited member. Such a member is said to hide the inherited member. Each enumeration declaration creates a new declaration space. Names are introduced into this declaration space through enum-member-declarations. Each block or switch-block creates a separate declaration space for local variables. Names are introduced into this declaration space through local-variable-declarations. If a block is the body of a constructor or method declaration, the parameters declared in the formal-parameter-list are members of the block’s local variable declaration space. The local variable declaration space of a block includes any nested blocks. Thus, within a nested block it is not possible to declare a local variable with the same name as a local variable in an enclosing block. Each block or switch-block creates a separate declaration space for labels. Names are introduced into this declaration space through labeled-statements, and the names are referenced through goto-statements. The label declaration space of a block includes any nested blocks. Thus, within a nested block it is not possible to declare a label with the same name as a label in an enclosing block. The textual order in which names are declared is generally of no significance. In particular, textual order is not significant for the declaration and use of namespaces, types, constants, methods, properties, events, indexers, operators, constructors, destructors, and static constructors. Declaration order is significant in the following ways: Declaration order for field declarations and local variable declarations determines the order in which their initializers (if any) are executed. Local variables must be defined before they are used. Declaration order for enum member declarations is significant when constant-expression values are omitted. The types of the C# language are divided into three categories: Value types, reference types, and 5

本科毕业设计(论文)外文翻译

pointer types. type: ➢ value-type ➢ reference-type ➢ pointer-type Pointer types can be used only in unsafe code. Value types differ from reference types in that variables of the value types directly contain their data, whereas variables of the reference types store references to their data, the latter known as objects. With reference types, it is possible for two variables to reference the same object, and thus possible for operations on one variable to affect the object referenced by the other variable. With value types, the variables each have their own copy of the data, and it is not possible for operations on one to affect the other. C#’s type system is unified such that a value of any type can be treated as an object. Every type in C# directly or indirectly derives from the object class type, and object is the ultimate base class of all types. Values of reference types are treated as objects simply by viewing the values as type object. Values of value types are treated as objects by performing boxing and unboxing operations . Variables represent storage locations. Every variable has a type that determines what values can be stored in the variable. C# is a type-safe language, and the C# compiler guarantees that values stored in variables are always of the appropriate type. The value of a variable can be changed through assignment or through use of the ++ and -- operators. A variable must be definitely assigned before its value can be obtained. As described in the following sections, variables are either initially assigned or initially unassigned. An initially assigned variable has a well defined initial value and is always considered definitely assigned. An initially unassigned variable has no initial value. For an initially unassigned variable to be considered definitely assigned at a certain location, an assignment to the variable must occur in every possible execution path leading to that location. Much of the C# language enables the programmer to specify declarative information about the entities defined in the program. For example, the accessibility of a method in a class is specified by decorating it with the method-modifiers public, protected, internal, and private. C# enables programmers to invent new kinds of declarative information, to specify declarative information for various program entities, and to retrieve attribute information in a run-time environment. For instance, a framework might define a HelpAttribute attribute that can be placed on program elements such as classes and methods to provide a mapping from program elements to documentation for them. New kinds of declarative information are defined through the declaration of attribute classes, which may have positional and named parameters. Declarative information is specified a C# program using attributes, and can be retrieved at run-time as attribute instances.

6

因篇幅问题不能全部显示,请点此查看更多更全内容