What’s New in the Visual C# 2008

The C# 3.0 language and compiler introduce several new language features. These new language constructs are useful individually in various contexts, and collectively for doing Language-Integrated Query (LINQ).

The following table lists the new C# 3.0 language features:

Feature Description
Implicitly Typed Local Variables and Arrays When used with local variables, the var keyword instructs the compiler to infer the type of the variable or the array elements from the expression on the right side of the initialization statement.
Object Initializers Enables object initialization without explicit calls to a constructor.
Collection Initializers Enables initialization of collections with an initialization list rather than specific calls to Add or another method.
Extension Methods Extend existing classes by using static methods that can be invoked by using instance method syntax.
Anonymous Types Enables on-the-fly creation of unnamed structured types that can be added to collections and accessed by using var.
Lambda Expressions Enables inline expressions with input parameters that can be bound to delegates or expression trees.
Query Keywords Keywords that specify clauses in a query expression:

  • from clause(s)
  • where clause (optional)
  • ordering clauses (optional)
  • join clause (optional)
  • select or group clause
  • into clause (optional)
Auto-Implemented Properties Enables declaration of properties by using simplified syntax.
Partial Method Definitions Partial types may now contain partial methods.

Visual C# IDE

Feature Description
Multi-targeting Visual Studio 2008 enables you to specify a version of the .NET Framework for your project, .NET Framework 2.0, 3.0, or 3.5. The .NET Framework target of an application is the version of the .NET Framework that is required on a computer to enable the application to run on that computer.
New Project Types and Templates Several new project templates are provided for Windows Presentation Foundation, Windows Communication Foundation, and Web projects.
IntelliSense support for C# 3.0 The Visual C# code editor provides statement completion and Quick Info to support the following new language constructs in C# 3.0:

  • Implicitly Typed Local Variables
  • Query Expressions
  • Extension Methods
  • Object/Collection Initializers
  • Anonymous Types
  • Lambda Expressions
  • Partial Methods

For more information, see Visual C# IntelliSense.

Refactoring Support for C# 3.0 The refactoring features, Rename, Signature Change, Extract Method, and Promote Local have been updated to support the following new language constructs:

  • Query Expressions
  • Extension Methods
  • Lambda Expressions

In addition, refactoring provides new options and warnings to help prevent unintended consequences from a refactoring action.

Code Formatting The code editor supports formatting options for several new C# 3.0 language constructs including query expressions.
Organizing Using Statements The Visual C# code editor provides an easy way to sort using and extern declarations and remove those that are not being used.
Posted in CSharp. Tags: , . 1 Comment »

One Response to “What’s New in the Visual C# 2008”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: