Visual C# Development Environment
What's New in Visual C#

Updated: July 2008

What's New in Visual C# 2008 Service Pack 1

C# Language

Feature

Description

Various Compiler Improvements

Many improvements have been made to the C# compiler to remove inconsistencies with the language specification. Some of these improvements are breaking changes, but others are just software updates or enhancements. For more information about the breaking changes, see Visual C# 2008 Breaking Changes. For more information about the other bugs fixed in Service Pack 1, see List of changes and fixed issues for Visual Studio 2008 Service Pack 1 Beta for Visual C#.

Visual C# IDE

Feature

Description

Live Semantic Errors

Visual C# 2008 Service Pack 1 introduces Live Semantic Errors, a new feature that provides a more complete set of error information about your code. This feature detects expression-level errors that were previously reported only after a build. It highlights the errors with red wavy underlines as you write code. For more information about wavy underlines, see Editing Code (Visual C#).

LINQ Query Debugging

Debugging of LINQ queries is greatly enhanced in Service Pack 1.

  • Range variables can now be viewed in the Watch window and in DataTips when you step through individual lines in a query expression.

  • The debugger no longer hides anonymous type names, and it allows them to appear in casts and instantiations. This enables temporary instances of anonymous types to be created during a debugging session. Casts to and from anonymous types are evaluated correctly.

  • The strings generated for Add to Watch have been improved and generate expressions that can be evaluated more often than in the original release version of Visual Studio 2008.

For more information, see Sree's ventures in code space on the Microsoft Web site.

Task List Comments Are Displayed for All Files in Solution

In previous releases of Visual Studio, the task list was populated only with task comments in open files. In Visual Studio 2008 Service Pack 1, the C# integrated development environment (IDE) displays the task comments in all open and closed files in the solution. For more information, see How to: Create Task List Comments.

Rename Refactoring in Windows Presentation Foundation Projects

Visual Studio 2008 Service Pack 1 enables you to use the rename refactoring feature to rename references that are defined in XAML. For more information about rename refactoring, see Rename.

LINQ

Feature

Description

Improvements to the System.Linq.Enumerable.Cast<T> Method

Visual C# 2008 Service Pack 1 improves the performance of the Enumerable.Cast<T> method by disabling the primitive value conversions and the explicitly defined user conversions. An example of a primitive value conversion is a conversion from the int data type to the long data type.

Improvements in the Performance of System.Linq.Enumerable.Where<TSource> and System.Linq.Enumerable.Select<TSource, TResult> Methods

Visual C# 2008 Service Pack 1 improves the performance of the Where standard query operator and of the Select standard query operator.

What's New in the Original Release Version of Visual C# 2008

C# 3.0 Language

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). For more information about LINQ, see The LINQ Project.

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. See also Anonymous Functions (C# Programming Guide).

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.

C# 3.0 Compiler

/win32Manifest and /noWin32Manifest compiler switches.

These new compiler switches are used to specify requested execution levels for programs running on Windows Vista.

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. For more information, see Targeting a Specific .NET Framework.

New Project Types and Templates

Several new project templates are provided for Windows Presentation Foundation, Windows Communication Foundation, and Web projects. For more information, see Project Templates in Visual C# Editions and Default Project Templates in Visual Studio.

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. For more information, see Refactoring.

Code Formatting

The code editor supports formatting options for several new C# 3.0 language constructs including query expressions. For more information, see Formatting, C#, Text Editor, Options Dialog Box.

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.

See Also

Other Resources

Change History

Date

History

Reason

July 2008

Added section about Visual C# 2008 Service Pack 1.

SP1 feature change.

Tags :


Community Content

Thomas Lee
what means int? declaration in C#

what means

int?

declaration in C#

Answer me please.

Sergey


[tfl - 25 09 09] Hi - and thanks for your post. You should post questions like this to the MSDN Forums at http://forums.microsoft.com/msdn or the MSDN Newsgroups at http://www.microsoft.com/communities/newsgroups/en-us/. You are much more likely get a quicker response using the forums than through the Community Content. For specific help about:
.NET Framework : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.dotnet.framework
PowerShell : http://groups.google.com/group/microsoft.public.windows.powershell/topics?pli=1
SQL Server : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.sqlserver%2C&
Visual Studio : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.vstudio%2C&
Windows : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.windows%2C&
All Public : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public%2C&


Tim0000007
int? question

Sorry for the pun. int? means that the variable is nullable. Ints in general must have a value. That is, they can't have null value. You can't code:

int myIntVariable = null; //won't compile

unless you add the ? mark to it, as in:

int? myIntVariable = null //will compile

Now why you would want to do this another question, but I have to go now.

Thanks,

Toney

Tags :

Arnshea
Why use nullable types?

Nullables are a great way to indicate that a value type hasn't been set.

Before nullable types you would typically solve this problem with 1 of 2 approaches:

  • Pick a value (e.g., INT_MIN or INT_MAX) and interpret it as meaning "no value has been set". What if INT_MIN and/or INT_MAX are valid values?
  • Add a boolean flag that tracks when the value has been set.

With nullable types the language makes solving this problem easier by adding a little extra syntax. You can check if your nullable type has a value with myIntVariable.HasValue.


Thomas Lee
What is requirement of Boxing & Unboxing?
Why r we using boxing & unboxing ? In this we change value type in reference type & vice versa.What its requirement.please tell me.

ok thank you.

[tfl - 25 09 09] Hi - and thanks for your post. You should post questions like this to the MSDN Forums at http://forums.microsoft.com/msdn or the MSDN Newsgroups at http://www.microsoft.com/communities/newsgroups/en-us/. You are much more likely get a quicker response using the forums than through the Community Content. For specific help about:
.NET Framework : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.dotnet.framework
PowerShell : http://groups.google.com/group/microsoft.public.windows.powershell/topics?pli=1
SQL Server : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.sqlserver%2C&
Visual Studio : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.vstudio%2C&
Windows : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.windows%2C&
All Public : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public%2C&


Page view tracker