1 / 52

New IDE and Language Features in Microsoft Visual Studio 2010 Using Visual Basic and C#

Required Slide. SESSION CODE: DEV204. New IDE and Language Features in Microsoft Visual Studio 2010 Using Visual Basic and C#. Ken Getz Senior Consultant MCW Technologies, LLC. Me.About. Senior Consultant with MCW Technologies

marlo
Télécharger la présentation

New IDE and Language Features in Microsoft Visual Studio 2010 Using Visual Basic and C#

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Required Slide SESSION CODE: DEV204 New IDE and Language Features in Microsoft Visual Studio 2010 Using Visual Basic and C# Ken Getz Senior Consultant MCW Technologies, LLC

  2. Me.About Senior Consultant with MCW Technologies Author of several developer’s books on ASP.NET, VB, Access, and VBA Lead courseware author for AppDev (http://www.appdev.com) keng@mcwtech.com

  3. Huge List of New Features • Breakpoint Labeling • Breakpoint Searching • Breakpoint Import/Export • Dynamic Data Tooling • WPF Tree Visualizer • Call Hierarchy • Improved WPF Tooling • Historical Debugging • Mini-Dump Debugging • Quick Search • Better Multi-Monitor Support • Highlight References • Parallel Stacks Window • Parallel Tasks Window • Document Map Margin • Generate from Usage • Concurrency Profiler • Extensible Test Runner • MVC Tooling • Web Deploy • JQuery IntelliSense • SharePoint Tooling • HTML Snippets • Web.config Transformation • ClickOnce Enhancements for Microsoft Office

  4. Too Many New Features… • Will focus on specific new features • Pertinent to most developers • Esoteric and advanced features some other time

  5. Two Faces of Visual Studio 2010 • Visual Studio as an Editor • Visual Studio as a Platform

  6. As An Editor… • An improved focus on… • Writing code • Understanding code • Navigating code • Publishing code • Shell rewritten using WPF • Adds many new capabilities

  7. As a Platform • Visual Studio 2010 supports gallery of extensions • Thriving third-party market

  8. VB & C# 2010 Language New in VS 2010 Already exists in VS 2008

  9. VB & C# 2010 IDE New in VS 2010 Already exists in VS 2008

  10. General Improvements • Start page • Rewritten using XAML—easy to customize • Recent Projects list: right-click, pin • New projects: Multi-targeting • New support for Silverlight, MFC, F#, Azure • Extended support for Office 2010, SharePoint • Extension manager • Gallery for Visual Studio extensions

  11. UI Improvements • Zoom • Docking Windows • Generate from Usage • Highlighting References • Navigate To/Quick Search • IntelliSense Consume-First Mode • Box Selection • Search in Add New Item dialog box

  12. Zoom • Ctrl+Mouse Wheel • New features that enhance the size of your code • Useful for presentations, pair programming

  13. Docking Windows • New docking visuals • Windows can be docked anywhere • Better use with multiple monitors

  14. Generate from Usage • Automatically creates “stub” code from code you have typed • Enables you to use classes and members before you define them

  15. Highlighting References • Automatic highlighting of symbols • Works with declarations, references, and many other symbols • Makes it easy to find all uses of a symbol

  16. Navigate To/Quick Search • Ctrl+, • Provides search-as-you-type support for files, types, and members • Enables quick searching • Provides “fuzzy” search • Ctrl+- goes back

  17. Box Selection • In VS 2008, could press ALT key to select rectangular region • Now, additional features: • Text insertion: Type into a box selection to insert text on every line • Paste contents from one box selection to another • Zero-width boxes • Make a vertical selection zero-width to create multi-line insertion point for new or copied text

  18. IntelliSense Consume-First Mode • IntelliSense provides two modes for statement completion • Completion mode • Suggestion mode • Useful when using classes and members before they’re defined • Editor shows symbol you type, rather than an entry from list • Use Ctrl+Alt+Spacebar to toggle • In Suggestion mode, code inserts what you’ve typed • Unless you press Tab, which inserts the selected text no matter which mode you’re in

  19. Search in Add New Item • Add New Item dialog box includes search mechanism • Type any part of a template’s name • Search does the rest

  20. Debugging Improvements • Can add labels to breakpoints • All breakpoints are searchable • Can import/export breakpoints

  21. Floating Data Tips • Data tips can float in the source window • Floating data tips remain visible until the debugging session ends

  22. New C#-only IDE Features • Many user-interface improvements • Two big new C#-only features: • Call Hierarchy • Organization of using statements

  23. Call Hierarchy • Ctrl+Alt+K (or Ctrl+K, T) • See calls to and from a method

  24. Organize Usings • Right-click on Using statement • Can delete unused, sort, or both

  25. New Language Features

  26. VB-Only Features • New features either already in C# 3, or not applicable in C# 4 • Implicit Line Continuation • Auto-implemented properties • Collection Initializers • Array Literals • Sub Lambdas • Multi-line Lambdas

  27. Implicit Line Continuation • Underscore in Visual Basic indicates that logical line split into multiple physical lines of code • Visual Basic 10 removes the requirement to include the token after certain tokens • If its presence can be inferred • Its use not completely removed • Won’t be necessary in vast majority of cases

  28. Implicit Line Continuation • Can be inferred: • After an attribute • After a comma • After a dot (for method invocation or property access) • After a binary operator • After a LINQ query clause • After a (, {, or <%= • Before a ), }, or %>

  29. Auto-Implemented Properties • For simple properties that get/set a value with a backing field, can use single statement • Visual Basic creates private field with same name as the property, prefixed with “_” • For property named FirstName, field named _FirstName • You can’t create a variable with this name • Visual Basic creates getter and setter • Cannot have properties, nor can be read- or write-only

  30. Collection Initializers • Provide a means of initializing a collection type and providing it with series of default values • Use From keyword to supply list, surrounded with {} • List can be nested • Works for Dictionary, for example • Simply calls Add method of class, passing in information • If no Add method, create your own as instance method or extension method

  31. Array Literals • Provide a compact syntax for declaring an array • Type inferred by the compiler • Useful when you want to provide default values for an array, and want to allow compiler to determine the type of the array

  32. Sub and Multi-Line Lambdas • In Visual Studio 2008, lambda expressions could only consist of a single statement that returned a value, in Visual Basic • Had to be a Function • In Visual Studio 2010, lambda expressions can be a Sub (as well as a Function) • Can also contain multiple statements • Effectively provides anonymous method functionality to Visual Basic

  33. C#-Only Features • Not many features exclusive to C# • Dynamic language support • Optional and Named Parameters • Dynamic type • COM Interop support

  34. Named and Optional Parameters • In order to provide support for dynamic languages • And better support for COM interop • C# 4 supports both named and optional parameters • To indicate an optional parameter, supply a default value • When invoked, can decline to supply a value and use default value instead • No comma counting allowed

  35. Named and Optional Parameters • Any argument can be passed by name, rather than by position • Solves the “no comma counting” problem • What do you do if you supply the first and last of a list of 10 optional parameters? • Generally, use two named parameters

  36. Dynamic Type • Dynamic lookup allows you to write method, operator, and indexer calls • Property and field accesses • Object invocations • Bypass C# static type checking and instead get resolved at runtime • Required in order to support dynamic languages • Helps with COM Interop

  37. COM Interop Support • Many COM methods accept and return variant types, represented as Object in the PIA • Most of the time, developer knows return type • But must explicitly cast returned value • Serious nuisance • Because of dynamic types, can make this easier

  38. Ref Parameters • Many COM methods contain reference parameters • Generally not meant to change a passed-in argument • Just old-fashioned parameter passing • In the past, C# developers required to create temporary variable for each ref parameter • And then pass each by reference • Now C# compiler allows you to pass parameters by value • Compiler creates temp variables, and discards later • You don’t worry about ref, and called method still gets a reference

  39. Parallel Language Features • Dealing with parallel threads in Visual Studio 2008 far too difficult • Difficult to create code, difficult to debug it • Task Parallel Library provides set of public types and APIs • Make developers more productive • Simplifies process of adding parallelism and concurrency • Focuses on the “what” not the “how” • Parallelism only makes sense with multiple processors or processor cores

  40. Parallel Static Class • When program statements are independent… • … they can be parallelized StatementA() StatementB() StatementC() Parallel.Invoke( StatementA(), StatementB(), StatementC())

  41. Parallel Static Class • In other words, if statements have no shared state, can easily be made to run in parallel • Parallel class provides several useful methods: • Invoke • For • ForEach • Why can’t compiler do this for you? • It has no idea about shared data, or state • Must be opt-in process • Up to you to ensure that statements are independent

  42. PLINQ • Technology allows developers to easily leverage multiple cores/processors (manycore) • If using LINQ to objects, requires only a single method call to existing query: • AsParallel • Turns query into a PLINQ query and will use PLINQ execution engine • AsParallel works by returning ParallelQuery (as opposed to IEnumerable)

  43. Thanks for Coming! • DEV204--New IDE and Language Features in Microsoft Visual Studio 2010 Using Visual Basic and C# • Ken Getz • keng@mcwtech.com

  44. Required Slide Speakers, please list the Breakout Sessions, Interactive Sessions, Labs and Demo Stations that are related to your session. Related Content • DEV307: F# in Microsoft Visual Studio 2010 (6/10 from 9:45am – 11:00am) • DEV315: Microsoft Visual Studio 2010 Tips and Tricks (6/8 from 5:00pm – 6:15pm) • DEV316: Modern Programming with C++Ox in Microsoft Visual C++ 2010 (6/8 from 3:15pm – 4:30pm) • DEV319: Scale and Productivity for C++ Developers with Microsoft Visual Studio 2010 (6/9 from 8:00am – 9:15am) • DEV401: Advanced Use of the new Microsoft Visual Basic 2010 Language Features (6/9 from 9:45am – 11:00am) • DEV404: C# in the Big World (6/8 from 1:30pm – 2:45pm) • DEV406: Integrating Dynamic Languages into Your Enterprise Applications (6/8 from 8am – 9:15am) • DEV407: Maintaining and Modernizing Existing Applications with Microsoft Visual Studio 2010 (6/10 from 8:00am – 9:15am)

  45. Required Slide Speakers, please list the Breakout Sessions, Interactive Sessions, Labs and Demo Stations that are related to your session. Related Content • DEV03-INT: Meet the C# team (6/9 from 1:30-2:45pm) • DEV04-INT: Meet the VB team (6/10 from 3:15 – 4:30pm) • DEV09-INT: Microsoft Visual Basic and C# IDE Tips and Tricks (6/7 from 4:30pm -5:45pm) • DEV10-INT: Using Dynamic Languages to build Scriptable Applications ((6/9 from 8:00am -9:15am) • DEV11–INT: IronPython Tools (6/10 from 5:00pm – 6:15pm)

  46. Required Slide Speakers, please list the Breakout Sessions, Interactive Sessions, Labs and Demo Stations that are related to your session. Related Content • DEV05-HOL: Introduction to F#

  47. Required Slide Track PMs will supply the content for this slide, which will be inserted during the final scrub. Track Resources • Visual Studio – http://www.microsoft.com/visualstudio/en-us/ • Soma’s Blog – http://blogs.msdn.com/b/somasegar/ • MSDN Data Developer Center – http://msdn.com/data • ADO.NET Team Blog – http://blogs.msdn.com/adonet • WCF Data Services Team Blog – http://blogs.msdn.com/astoriateam • EF Design Blog – http://blogs.msdn.com/efdesign

  48. Required Slide Resources Learning • Sessions On-Demand & Community • Microsoft Certification & Training Resources www.microsoft.com/teched www.microsoft.com/learning • Resources for IT Professionals • Resources for Developers • http://microsoft.com/technet • http://microsoft.com/msdn

  49. Required Slide Complete an evaluation on CommNet and enter to win!

  50. Sign up for Tech·Ed 2011 and save $500 starting June 8 – June 31st http://northamerica.msteched.com/registration You can also register at the North America 2011 kiosk located at registrationJoin us in Atlanta next year

More Related