Monday, January 19, 2009

C# 3.0 Language Enhancements

C# 3.0 Language Enhancements

The C# 3.0 language enhancements build on C# 2.0 to increase developer productivity: they make written code more concise and make working with data as easy as working with objects.  These features provide the foundation for the LINQ project, a general purpose declarative query facility that can be applied to in-memory collections and data stored in external sources such as XML files and relational databases.

 

The C# 3.0 language enhancements consist of:

            Auto-implemented properties, which automate the process of creating properties with trivial implementations. 

            Implicitly typed local variables, which permit the type of local variables to be inferred from the expressions used to initialize them.

            Implicitly typed arrays, a form of array creation and initialization that infers the element type of the array from an array initializer. 

            Extension methods, which make it possible to extend existing types and constructed types with additional methods.

            Lambda expressions, an evolution of anonymous methods that concisely improves type inference and conversions to both delegate types and expression trees.

            Expression trees, which permit lambda expressions to be represented as data (expression trees) instead of as code (delegates).

            Object and collection initializers, which you can use to conveniently specify values for one or more fields or properties for a newly created object, combining creation and initialization into a single step.

            Query expressions, which provide a language-integrated syntax for queries that is similar to relational and hierarchical query languages such as SQL and XQuery.

            Anonymous types, which are tuple types automatically inferred and created from object initializers.

No comments:

Post a Comment