Summary of the content on the page No. 1
Summary of the content on the page No. 2
® Microsoft ® Visual Studio 2010 A Beginner’s Guide
Summary of the content on the page No. 3
About the Author Joe Mayo started his software development career in 1986, working on an RCA Spectrum 70 mainframe computer, programming in assembly language where input was via Hollerith card, output was a line printer, and the debugging experience was a light panel where you had to push buttons to load registers and step through commands. Since then, Joe has worked with various mini-computers, workstations, and PCs. The operating systems he’s worked on include proprietary, UNIX-based, MS-
Summary of the content on the page No. 4
® Microsoft ® Visual Studio 2010 A Beginner’s Guide Joe Mayo New York Chicago San Francisco Lisbon London Madrid Mexico City Milan New Delhi San Juan Seoul Singapore Sydney Toronto
Summary of the content on the page No. 5
Copyright © 2010 by The McGraw-Hill Companies. All rights reserved. Except as permitted under the United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the publisher. ISBN: 978-0-07-166896-5 MHID: 0-07-166896-9 The material in this eBook also appears in the print version of this title: ISBN: 978-0-07-166895-8, MHID: 0-07-166895-0. All tra
Summary of the content on the page No. 6
To my son, Kamo.
Summary of the content on the page No. 7
This page intentionally left blank
Summary of the content on the page No. 8
Contents at a Glance PART I Understanding Visual Studio 2010 Essentials 1 Introducing Visual Studio 2010 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2 Learning Just Enough C# or VB.NET: Basic Syntax . . . . . . . . . . . . . . . . . . . . . 35 3 Learning Just Enough C# and VB.NET: Types and Members . . . . . . . . . . . . 67 4 Learning Just Enough C# and VB.NET: Intermediate Syntax . . . . . . . . . . . 89 PART II Learning the VS 2010 Environme
Summary of the content on the page No. 9
viii Microsoft Visual Studio 2010: A Beginner’s Guide 10 Designing Silverlight Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 11 Deploying Web Services with WCF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299 PART IV Enhancing the VS 2010 Experience 12 Customizing the Development Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341 13 Extending Visual Studio 2010 . . . . . . . . .
Summary of the content on the page No. 10
Contents ACKNOWLEDGMENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix PART I Understanding Visual Studio 2010 Essentials 1 Introducing Visual Studio 2010 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 What Is Visual Studio 2010
Summary of the content on the page No. 11
x Microsoft Visual Studio 2010: A Beginner’s Guide Floating Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Tabbed Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Closing and Opening Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Modifying Environment Settings after Set
Summary of the content on the page No. 12
Contents xi Returning Data and Using Method Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 Method Snippets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 Coding Fields and Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 Declaring and Using Fields . . . . . . . . . . . . . . . . . . . . . . . . . . .
Summary of the content on the page No. 13
xii Microsoft Visual Studio 2010: A Beginner’s Guide Compiling Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 Building Solutions/Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 Rebuilding Solutions/Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 Cleaning Solutions/Projects
Summary of the content on the page No. 14
Contents xiii Learning Language Integrated Query (LINQ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 Querying Object Collections with LINQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 Creating a LINQ Projection with Anonymous Types . . . . . . . . . . . . . . . . . . . . . . . . . . 198 Using LINQ to Sort Collection Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 Handling Data
Summary of the content on the page No. 15
xiv Microsoft Visual Studio 2010: A Beginner’s Guide Assigning MasterPage Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 Partial Views (a.k.a. User Controls) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 Managing Routing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 Building a Customer Management
Summary of the content on the page No. 16
Contents xv Writing Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360 Recording a Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360 Saving a Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364 Editing Macros . . . . . . . . . . . . .
Summary of the content on the page No. 17
This page intentionally left blank
Summary of the content on the page No. 18
Acknowledgments work of this magnitude is never the ramblings of a single author, but a successful A combination of dedication from a team of highly skilled professionals. I would like to personally thank several people who helped make this book possible. Jane Brownlow, Executive Editor, helped kick off the book and got it started on the right path. Megg Morin, Acquisitions Editor, took the reins from Jane and led the rest of the way. Joya Anthony, Acquisitions Coordinator, helped keep the
Summary of the content on the page No. 19
This page intentionally left blank
Summary of the content on the page No. 20
Introduction isual Studio has been the primary integrated development environment (IDE) for VMicrosoft software development for several years. Visual Studio 2010 (VS), the subject of this book, is therefore a mature evolution, building upon the success of its predecessors. This book will show you how to leverage Visual Studio 2010 to your advantage, increasing your skill set, and helping you become more productive in building software. The software you will learn to write will be for .NET (