用户名:
密  码:
验证码:
 
JAVA J2EE J2ME J2SE JSP C/C++ C语言 C++ VC MFC Web前台 Html css JavaScript 软件测试 软件测试入门 LoadRunner Windows Win2008 Win2003 WinXP
.NET ASP.NET VB.NET MVC Linux/Unix Linux Unix Shell Web开发 PHP ASP Ajax IIS Apache 编程语言 C VB Delphi 汇编 数据库 MSSQL Mysql Oracle

C#3.0 Sepcification(中英对照)

www.diybl.com 时间:2007-10-04 作者:佚名 编辑:本站 点击:  [评论]

C#

Version 3.0 Specification
September 2005


[quote]
Notice
© 2005 Microsoft Corporation. All rights reserved.
Microsoft, Windows, Visual Basic, Visual C#, and Visual C++ are either registered trademarks or trademarks of Microsoft Corporation in the U.S.A. and/or other countries/regions.
Other product and company names mentioned herein may be the trademarks of their respective owners.[/quote]





[quote]Table of Contents
目录
26. Overview of C# 3.0 (C# 3.0 概述)............................................................................................ 5
26.1 Implicitly typed local variables 隐型局部变量(Implicity typed local variables)...................................... 5
26.2 Extension methods 扩展方法............................................................................................................ 6
26.2.1 Declaring extension methods 声明扩展方法................................................................................ 6
26.2.2 Importing extension methods 导入扩展方法................................................................................ 7
26.2.3 Extension method invocations 扩展方法的调用........................................................................... 7
26.3 Lambda expressions Lambda表达式................................................................................................. 8
26.3.1 Lambda expression conversions Lambda 表达式转换................................................................ 10
26.3.2 Type inference 类型推导......................................................................................................... 11
26.3.3 Overload resolution 重载决议................................................................................................... 13
26.4 Object and collection initializers 对象和集合的初始化器................................................................. 14
26.4.1 Object initializers 对象初始化器............................................................................................... 14
26.4.2 Collection initializers 集合初始化器.......................................................................................... 16
26.5 Anonymous types 匿名类型............................................................................................................ 17
26.6 Implicitly typed arrays 隐型数组(Implicitly typed arrays).................................................................. 18
26.7 Query expressions 查询表达式....................................................................................................... 19
26.7.1 Query expression translation 查询表达式的转换....................................................................... 20
26.7.1.1 where clauses where子句................................................................................................... 21
26.7.1.2 select clauses select 子句................................................................................................... 21
26.7.1.3 group clauses group子句..................................................................................................... 21
26.7.1.4 orderby clauses orderby 子句.............................................................................................. 22
26.7.1.5 Multiple generators 多重产生器(generator) ....................................................................... 22
26.7.1.6 into clauses info 子句.......................................................................................................... 23
26.7.2 The query expression pattern 查询表达式模式.......................................................................... 23
26.7.3 Formal translation rules 正式的转换规则.................................................................................. 24
26.8 Expression trees 表达式树............................................................................................................ 26[/quote]

[quote]
26. Overview of C# 3.0 (C# 3.0概述)
C# 3.0 (“C# orcas”) introduces several language extensions that build on C# 2.0 to support the creation and use of higher order, functional style class libraries. The extensions enable construction of compositional APIs that have equal expressive power of query languages in domains such as relational databases and XML. The extensions include:
C# 3.0 (“C# 魔兽(Orcas)”) 引入了几个构建在C# 2.0上的语言扩展,用来支持创建和使用更高级的函数式(functional或译:泛函)类库。这些扩展允许组合(compositional) APIs的构造,这些APIs与关系数据库和XML等领域中的查询语言具有同等的表达力。
· Implicitly typed local variables, which permit the type of local variables to be inferred from the expressions used to initialize them.
· 隐型局部变量,允许局部变量的类型从初始化它们的表达式推导而来。
· Extension methods, which make it possible to extend existing types and constructed types with additional methods.
· 扩展方法,使得使用附加(additional)的方法扩展已存在的类型和构造类型成为可能。
· Lambda expressions, an evolution of anonymous methods that provides improved type inference and conversions to both delegate types and expression trees.
· Lambda 表达式,是匿名方法的演进,可提供改良的类型推导和到dalegate类型和表达式树的转换。
· Object initializers, which ease construction and initialization of objects.
· 对象初始化器,简化了对象的构造和初始化。
· Anonymous types, which are tuple types automatically inferred and created from object initializers.
· 匿名类型,是从对象初始化器自动推导和创建的元组(tuple)类型。
· Implicitly typed arrays, a form of array creation and initialization that infers the element type of the array from an array initializer.
· 隐型数组,数组创建和初始化的形式,它从数组初始化器推导出数组的元素类型。
· Query expressions, which provide a language integrated syntax for queries that is similar to relational and hierarchical query languages such as SQL and XQuery.
· 查询表达式,为类似于关系型和层次化查询语言(比如SQL和XQuery)提供一个语言集成(intergrated)的语法。
· Expression trees, which permit lambda expressions to be represented as data (expression trees) instead of as code (delegates).
· 表达式树,允许lambda表达式表示为数据(表达式树)而不是代码(delegate)。
This document is a technical overview of those features. The document makes reference to the C# Language Specification 1.2 (§1 through §18) and the C# Language Specification 2.0 (§19 through §25), both of which are available on the C# Language Home Page (http://msdn.microsoft.com/vcsharp/language).
本文档是这些特征的技术概述。文档引用了C#语言规范1.2(§1-§18)和C#语言规范2.0(§19-§25),这两个规范都在C#语言主页上(http://msdn.microsoft.com/vcsharp/language)
26.1 Implicitly typed local variables隐型局部变量
In an implicitly typed local variable declaration, the type of the local variable being declared is inferred from the expression used to initialize the variable. When a local variable declaration specifies var as the type and no type named var is in scope, the declaration is an implicitly typed local variable declaration. For example:
在隐型局部变量声明中,正被声明的局部变量的类型从初始化这个变量的表达式推导得来。当局部变量声明指明var作为类型,并且该范围域(scope)中没有var名称的类型存在,这个声明就称为隐型局部声明。例如:
var i = 5;
var s = "Hello";
var d = 1.0;
var numbers = new int[] {1, 2, 3};
var orders = new Dictionary();
The implicitly typed local variable declarations above are precisely equivalent to the following explicitly typed declarations:
上面的隐型局部变量声明精确地等同于下面的显型(explicitly typed)声明:
int i = 5;
string s = "Hello";
double d = 1.0;
int[] numbers = new int[] {1, 2, 3};
Dictionary orders = new Dictionary();
A local variable declarator in an implicitly typed local variable declaration is subject to the following restrictions:
隐型局部变量声明中的局部变量声明符(declarator)遵从下面这些约束:
· The decla

 1 2 3 4 5 6 7 8 9
如果图片或页面不能正常显示请点击这里 站内搜索:
推荐文章
文章评论
请您留言
昵称:  
验证码:
注册会员
会员登陆
频道地图