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的基礎上引入了很多語言擴充,用以支援進階別的函數式風格類庫的建立和使用。這些擴充使得結構性API構造具有與其他領域(如關聯式資料庫和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.
(展方法,使得對一個現存類型的擴充和構造具有附加方法的類型變為現實。)
· Lambda expressions, an evolution of anonymous methods that provides improved type inference and conversions to both delegate types and expression trees.(拉姆達(Lambda)運算式,匿名方法的一種進化,為委託類型和運算式樹狀架構提供了改進的類型推斷和轉換。)
· Object initializers, which ease construction and initialization of objects.(對象初始化器,使得構造和初始化對象變得容易。)
· Anonymous types, which are tuple types automatically inferred and created from object initializers.(匿名型別,由對象初始化器推斷和建立出來的類型。)
· 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類似。)
· Expression trees, which permit lambda expressions to be represented as data (expression trees) instead of as code (delegates).(運算式樹狀架構,允許將拉姆達運算式表現為資料(運算式樹狀架構),而不是代碼(委託)。)