www.it-ebooks.info www.it-ebooks.info VISUAL STUDIO® 2010 AND .NET 4 SIX-IN-ONE INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxiii PART I VISUAL STUDIO CHAPTER 1 History of Visual Studio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 CHAPTER 2 Visual Studio UI Enhancements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 CHAPTER 3 Visual Studio Code Snippets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31 CHAPTER 4 Visual Studio Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 CHAPTER 5 Getting the Most Out of the IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 CHAPTER 6 Visual Studio Extensibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 PART II .NET 4 CHAPTER 7 .NET Framework Version History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 CHAPTER 8 Modern UI Frameworks (WPF and Silverlight) . . . . . . . . . . . . . . . . . . . . 297 CHAPTER 9 Windows Communication Foundation (WCF) . . . . . . . . . . . . . . . . . . . . . 375 CHAPTER 10 Enhancements to the .NET Core Framework . . . . . . . . . . . . . . . . . . . . . 399 CHAPTER 11 Enhancements to the .NET Workfl ow Framework . . . . . . . . . . . . . . . . . 489 CHAPTER 12 Enhancements to the .NET Data Framework . . . . . . . . . . . . . . . . . . . . . 563 CHAPTER 13 Enhancements to the .NET Communication Framework . . . . . . . . . . . 581 CHAPTER 14 .NET Charting Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593 PART III ASP.NET 4.0 CHAPTER 15 ASP.NET Version History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 653 CHAPTER 16 ASP.NET Charting Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 669 CHAPTER 17 ASP.NET Dynamic Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711 CHAPTER 18 ASP.NET Model View Controller (MVC) . . . . . . . . . . . . . . . . . . . . . . . . . . .751 CHAPTER 19 ASP.NET Ajax Improvements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 837 CHAPTER 20 ASP.NET Ajax Control Toolkit and jQuery . . . . . . . . . . . . . . . . . . . . . . . . 893 ffirs.indd iffirs.indd i 9/6/10 7:21:25 PM9/6/10 7:21:25 PM www.it-ebooks.info PART IV VB.NET CHAPTER 21 History of Visual Basic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 981 CHAPTER 22 Visual Basic 10.0 Language Improvements . . . . . . . . . . . . . . . . . . . . . . 1007 PART V C# CHAPTER 23 History of C# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1041 CHAPTER 24 C# 4.0 Language Improvements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1065 PART VI F# CHAPTER 25 Visual F# and the Other .NET Languages . . . . . . . . . . . . . . . . . . . . . . . .1103 INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1173 ffirs.indd iiffirs.indd ii 9/6/10 7:21:26 PM9/6/10 7:21:26 PM www.it-ebooks.info Visual Studio® 2010 and .NET 4 SIX-IN-ONE ffirs.indd iiiffirs.indd iii 9/6/10 7:21:26 PM9/6/10 7:21:26 PM www.it-ebooks.info ffirs.indd ivffirs.indd iv 9/6/10 7:21:26 PM9/6/10 7:21:26 PM www.it-ebooks.info Visual Studio® 2010 and .NET 4 SIX-IN-ONE István Novák András Velvárt Adam Granicz György Balássy Attila Hajdrik Mitchel Sellers Gastón C. Hillar Ágnes Molnár Joydip Kanjilal ffirs.indd vffirs.indd v 9/6/10 7:21:26 PM9/6/10 7:21:26 PM www.it-ebooks.info Visual Studio ® 2010 and .NET 4 Six-in-One Published by Wiley Publishing, Inc. 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright © 2010 by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada ISBN: 978-0-470-49948-1 ISBN: 978-1-118-00113-4 (ebk) ISBN: 978-1-118-00295-7 (ebk) ISBN: 978-1-118-00298-8 (ebk) Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1 No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions. Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifi cally disclaim all warranties, including without limitation warranties of fi tness for a particular purpose. No warranty may be created or extended by sales or promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional assistance is required, the services of a competent professional person should be sought. Neither the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or Web site may provide or recommendations it may make. Further, readers should be aware that Internet Web sites listed in this work may have changed or disappeared between when this work was written and when it is read. For general information on our other products and services please contact our Customer Care Department within the United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002. Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books. Library of Congress Control Number: 2010924589 Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Programmer to Programmer, and related trade dress are trade- marks or registered trademarks of John Wiley & Sons, Inc. and/or its affi liates, in the United States and other countries, and may not be used without written permission. Visual Studio is a registered trademark of Microsoft Corporation in the United States and/or other countries. All other trademarks are the property of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book. ffirs.indd viffirs.indd vi 9/6/10 7:21:27 PM9/6/10 7:21:27 PM www.it-ebooks.info To Henriett, Eszter and Reka, who supported me in writing this book with their love and appreciation. — Istv á n Nov á k To Á gi, always. — Gy ö rgy Bal á ssy First and foremost, I would like to thank my daughter, Patr í cia Csenge, for always making me smile and for understanding while I was writing this book instead of playing with her on weekends. She is my everything, and I dedicate this book to her. I also thank my wife, Eszter, for standing beside me throughout my career and while I was writing this book. — Attila Hajdrik To my son, Kevin, and my nephew, Nicolas. — Gast ó n C. Hillar ffirs.indd viiffirs.indd vii 9/6/10 7:21:27 PM9/6/10 7:21:27 PM www.it-ebooks.info ffirs.indd viiiffirs.indd viii 9/6/10 7:21:27 PM9/6/10 7:21:27 PM www.it-ebooks.info [...]... computers and mobile devices at the same time to test each code snippet —Gastón C Hillar xvi www.it-ebooks.info ffirs.indd xvi 9/6/10 7:21:30 PM CONTENTS INTRODUCTION xxxiii PART I: VISUAL STUDIO CHAPTER 1: HISTORY OF VISUAL STUDIO Roots 3 4 The First Breakthrough: Visual Basic Other Languages and Tools Visual Studio 97 and 6.0 4 4 5 Visual Studio. NET 2002 and 2003 Visual Studio 2005 Visual Studio 2008 Visual. .. Extensibility Visual Studio Package Development Editor Extensibility Creating Visual Studio Macros Understanding the Structure of Macros Using the Macros IDE Recording and Developing Macros Macro Samples Creating Visual Studio Add-Ins 2 04 2 04 208 209 210 210 211 212 213 213 218 221 225 229 Add -In Architecture Creating a Simple Add -In Using the Automation Model Going on with Add -In Development 229 230 239 241 Visual. .. Importing Templates Creating a Template Installation Kit Summary 111 1 14 125 xviii www.it-ebooks.info TOC.indd xviii 9/6/10 7:23:13 PM CONTENTS CHAPTER 5: GETTING THE MOST OUT OF THE IDE Window Management 127 128 Visual Studio Window Architecture Tool Windows Document Windows Arranging Windows 128 131 132 1 34 Customizing Menus and Toolbars 138 The Customize Dialog Adding Menus and Commands Creating and. .. Accessing the Visual Studio Context Accessing the Visual Studio Object Model A Few More Points About Start Pages Customizing the Toolbox 163 173 176 182 186 186 A Lap Around the Toolbox Customizing Toolbox Tabs Adding Items to the Toolbox A Few More Points About Toolbox Customization Visual Studio Gallery 186 189 190 193 193 Browsing the Visual Studio Gallery Downloading and Installing Components Adding... and Rearranging Toolbars Context Sensitivity IDE Configuration 139 140 144 145 145 The Options Dialog Changes in Option Pages Visual Studio Settings 145 147 150 Reducing Efforts with Keyboard Shortcuts 155 Command Routing and Command Contexts Working with Keyboard Shortcuts Working with Keyboard Mapping Schemes 155 157 160 Custom Start Pages 162 Creating Your First Custom Start Page Changing the StartPage.xaml... ASP.NET AJAX IMPROVEMENTS Understanding Ajax 837 838 The XMLHttpRequest Object ASP.NET and Ajax Using the ASP.NET Ajax Server Controls Refactoring the Framework Libraries Using the Microsoft CDN Using the Microsoft Ajax Library Working with DOM Elements The Script Loader Client-Side Data Binding with Templates Advanced Data-Binding Scenarios Working with Server-Side Data Summary 839 840 841 844 846 848 ... 633 Annotations Binding Data to Series The DataManipulator class More Chart Manipulations 633 638 641 648 Summary 649 PART III: ASP.NET 4. 0 CHAPTER 15: ASP.NET VERSION HISTORY Development of the Web and Web Development Enter ASP Enter ASP.NET ASP.NET Version History ASP.NET 1.0 ASP.NET 1.1 ASP.NET 2.0 ASP.NET 3.0 ASP.NET 3.5 ASP.NET 3.5 SP1 ASP.NET 4. 0 653 653 6 54 655 657 659 659 659 6 64 665 667 667 Summary... Filters Chaining and Utility Functions Eventing Model and Event Handlers Visual Effects and Animations jQuery Ajax Features Summary 963 965 970 971 975 976 977 PART IV: VB.NET CHAPTER 21: HISTORY OF VISUAL BASIC The Roots of Visual Basic Structured and Unstructured BASIC Moving to Visual Visual Basic in the 1990s Visual Basic in the NET Framework Design Goals and Debates Visual Basic NET (7.0) and NET... 795 8 04 Routing Details 816 Controller Factory In uencing the Execution Flow Authorization Action and Result Filtering Exception Filtering ActionResult Testing with MVC 2 816 817 819 821 822 822 8 24 Refactoring AcmeLibrary Creating and Running Unit Tests 8 24 831 A Few More Points on MVC 2 8 34 Areas Metadata Providers Value Providers Model Binders Child Actions Asynchronous Controllers 8 34 8 34 8 34 835... Studio 2008 Visual Studio 2010 5 7 8 10 Changes in Editions What’s New in Visual Studio 2010 Shift to WPF 10 12 12 Summary 13 CHAPTER 2: VISUAL STUDIO UI ENHANCEMENTS Basic IDE Overview 15 15 Exploring the Start Page Understanding Window Management New Project Dialog Window Creating New Projects in a New Way Using the Add Reference Dialog Window Using the Extension Manager Exploring New Daily Development . vffirs.indd v 9/6/10 7:21:26 PM9/6/10 7:21:26 PM www.it-ebooks.info Visual Studio ® 2010 and .NET 4 Six- in- One Published by Wiley Publishing, Inc. 1 047 5 Crosspoint Boulevard Indianapolis, IN 46 256 www.wiley.com Copyright. Studio. NET 2002 and 2003 5 Visual Studio 2005 7 Visual Studio 2008 8 Visual Studio 2010 10 Changes in Editions 10 What’s New in Visual Studio 2010 12 Shift to WPF 12 Summary 13 CHAPTER 2: VISUAL STUDIO. PM www.it-ebooks.info CONTENTS INTRODUCTION xxxiii PART I: VISUAL STUDIO CHAPTER 1: HISTORY OF VISUAL STUDIO 3 Roots 4 The First Breakthrough: Visual Basic 4 Other Languages and Tools 4 Visual Studio 97 and 6.0 5 Visual Studio. NET