software architecture new features of visual studio 2010 / .net 4.0 - part 1 - editor and c#

12
New features of Microsoft Visual Studio 2010 By: Shahzad Sarwar To: Development Team

Upload: shahzad

Post on 12-May-2015

1.656 views

Category:

Technology


0 download

DESCRIPTION

Topic:Software Architecture New Features of Visual Studio 2010 / .Net 4.0 - Part 1 - Editor And C# By : Shahzad Sarwar www.shahzadsb.com

TRANSCRIPT

Page 1: Software Architecture New Features of Visual Studio 2010 / .Net 4.0  - Part 1 - Editor And C#

New features of Microsoft Visual Studio 2010By: Shahzad Sarwar To: Development Team

Page 2: Software Architecture New Features of Visual Studio 2010 / .Net 4.0  - Part 1 - Editor And C#

Scope

• There is a very long list of features added by Microsoft in Visual Studio 2010.This presentation will cover only features of Visual studio Editor 2010 and C# language.

• Separate presentations will be required to touch features in WPF,LINQ,WCF, Windows workflow and other elements of .Net framework 4.0

Page 3: Software Architecture New Features of Visual Studio 2010 / .Net 4.0  - Part 1 - Editor And C#

Generate From UsageTrick is to first use class,its properies,its method , its

constructor and then generate code on basis of usage by simply pressing CTRL + “.” several times. [Demo]

• Generating a Class from Usage• Generating a Delegate Stub from Usage• Generating an Interface Stub from Usage• Generating New Types with Additional Options from Usage

( General for all )• http://msdn.microsoft.com/en-us/library/dd409796.aspx

Page 4: Software Architecture New Features of Visual Studio 2010 / .Net 4.0  - Part 1 - Editor And C#

Intelliense Modes• Use suggestion mode when classes and members are used

before they are defined.• In suggestion mode, when you type in the editor and then

commit the entry, the text you typed is inserted into the code. When you commit an entry in completion mode, the highlighted entry in the members list is inserted into the code.

• To avoid this problem, press CTRL+ALT+SPACEBAR to switch to IntelliSense suggestion mode (as opposed to completion mode).

http://msdn.microsoft.com/en-us/library/exbffbc2.aspx

Page 5: Software Architecture New Features of Visual Studio 2010 / .Net 4.0  - Part 1 - Editor And C#

Call Hierarchy window• The new Call Hierarchy window helps you analyze your

code and navigate within it. Declaration or an actual call, right-click it then and click View Call Hierarchy (or press CTRL+ALT+K).

• See Go To Definition, Find All References, and Add as New Root for each member.

Page 6: Software Architecture New Features of Visual Studio 2010 / .Net 4.0  - Part 1 - Editor And C#

Navigate To optionA quick search tool for symbols Just press CTRL + “,” (or click Edit and then Navigate To) to see the new Navigate To

window.

Page 7: Software Architecture New Features of Visual Studio 2010 / .Net 4.0  - Part 1 - Editor And C#

Productivity OptionsReference Highlighting• Put the cursor on a symbol (method, property, variable,

etc.), all instances of this symbol are automatically highlighted in the code editor.

• Navigate from one instance to another within a file by pressing CTRL+SHIFT+UP/DOWN ARROW.

Box Selection and Multiline Editing• Press ALT and then use your mouse or arrow keys to

select the box area.• Multiline box selection was there for delete from many

versions of studio. But now insert,edit,replace is also supported.

• http://blogs.msdn.com/b/vseditor/archive/2009/05/25/the-new-box-selection-now-with-multi-line-editing.aspx

Page 8: Software Architecture New Features of Visual Studio 2010 / .Net 4.0  - Part 1 - Editor And C#

WPF Based GUI• Moving Visual Studio to WPF helped to improve

multiple-monitor support. moving Visual Studio to WPF helped to improve multiple-monitor support.

• Undock any window and rearrange everything according to your needs.

• Zoom: Press CTRL and use your mouse wheel to enlarge or decrease your font size.

Page 9: Software Architecture New Features of Visual Studio 2010 / .Net 4.0  - Part 1 - Editor And C#

Dynamic Support • Provides support for late binding to dynamic types by introducing

a new type, dynamic.• http://msdn.microsoft.com/en-us/library/dd264736.aspx• http://blogs.msdn.com/b/csharpfaq/archive/tags/dynamic/Difference b/w Object and Dynamic • main differences between object and dynamic – with dynamic

you tell the compiler that the type of an object can be known only at run time, and the compiler doesn’t try to interfere. [Sample Code/Demo]

• It is no more (no less) dangerous than the object keyword.Where to use:• Perform so many cast operations that it makes your code almost

unreadable.• Situations when a simple cast is not enough and needs reflection

methods, such as InvokeMember or GetProperties.• Enable scenarios that were either impossible or difficult, including

interoperation with dynamic languages. • http://blogs.msdn.com/b/csharpfaq/archive/2010/01/25/what-is-

the-difference-between-dynamic-and-object-keywords.aspx

Page 10: Software Architecture New Features of Visual Studio 2010 / .Net 4.0  - Part 1 - Editor And C#

Type Equivalence Support Can now deploy an application that has

embedded type information instead of type information that is imported from a Primary Interop Assembly (PIA).If various versions of the runtime assembly are published, the application that contains the embedded type information can work with the various versions without having to be recompiled.

• http://msdn.microsoft.com/en-us/library/dd409610.aspx

Page 11: Software Architecture New Features of Visual Studio 2010 / .Net 4.0  - Part 1 - Editor And C#

Covariance and ContravarianceCovariance enables you to use a more derived type

than that specified by the generic parameter, whereas contravariance enables you to use a less derived type. This allows for implicit conversion of classes that implement variant interfaces and provides more flexibility for matching method signatures with variant delegate types.

[Sample/Code]• http://msdn.microsoft.com/en-us/library/

ee207183.aspx

Page 12: Software Architecture New Features of Visual Studio 2010 / .Net 4.0  - Part 1 - Editor And C#

• Lets have a meeting to discuss these new features.

• Must read the references of URL identified in presentation

• Best of luck for coding in new envirnment• Keep visiting • http://softarchitect.wordpress.com/