15.02.2015 Views

C# 4 and .NET 4

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Multi-Targeting the .neT framework ❘ 403<br />

As you can see, these wizards make it quite simple to refactor your code not just on one page but also for an<br />

entire application. Also included are the capabilities to do the following:<br />

➤<br />

➤<br />

➤<br />

➤<br />

➤<br />

Rename method names, local variables, fields, <strong>and</strong> more<br />

Extract methods from a selection of code<br />

Extract interfaces based on a set of existing type members<br />

Promote local variables to parameters<br />

Rename or reorder parameters<br />

You will find the refactoring capabilities provided by Visual Studio 2010 a great way to get the cleaner, more<br />

readable, better-structured code that you are looking for.<br />

kulTi-TargeTing The .neT frameWorK<br />

Visual Studio 2010 allows you to target the version of the .<strong>NET</strong> Framework that you want to work with.<br />

When you open the New Project dialog <strong>and</strong> get ready to create a new project, you will notice that there is a<br />

drop-down list in the upper-right corner of the dialog that allows you to pick the version of the framework<br />

that you are interested in using. This dialog is presented in Figure 16-29.<br />

From this figure, you can see that the drop-down list provides you with the ability to target the .<strong>NET</strong><br />

Frameworks 2.0, 3.0, 3.5, <strong>and</strong> 4. When you use the upgrade dialog to upgrade a Visual Studio 2008<br />

solution to Visual Studio 2010, it is important to underst<strong>and</strong> that you are only upgrading the solution to<br />

use Visual Studio 2010 <strong>and</strong> that you are not upgrading your project to the .<strong>NET</strong> Framework 4. Your project<br />

will stay on the framework version you were using, but now, you will be able use the new Visual Studio<br />

2010 to work on your project.<br />

figure 16-29<br />

If you want to change the version of the framework the solution is using, right-click the project <strong>and</strong> select<br />

the properties of the solution. If you are working with an ASP.<strong>NET</strong> project, you will get a dialog as shown<br />

in Figure 16-30.<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!