ebook img

Pro VB 2010 and the .NET 4.0 Platform PDF

1801 Pages·2010·24.59 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Pro VB 2010 and the .NET 4.0 Platform

CYAN  YELLOW  MAGENTA  BLACK  PANTONE 123 C BOOKS FOR PROFESSIONALS BY PROFESSIONALS® THE EXPERT’S VOICE® IN .NET Companion eBook Available Pro VB 2010 and the .NET 4 Pro Platform V Dear Reader, Andrew Troelsen, Author of With the core VB language stable, the 4th edition of the .NET platform has Pro C# 2010 and the .NET 4 brought with it a massive wealth of new functionality. The new edition of this Pro Platform book is your guide to learning the ins and outs of the .NET 4 platform and B Pro VB 2008 and the .NET 3.5 Visual Studio 2010, including: Platform Pro Expression Blend 4 • the Dynamic Language Runtime (DLR) VB 2010 Expert ASP.NET 2.0 • the Task Parallel Library (TPL, including PLINQ) and • the completely revamped WF 4 API Advanced Application Design 2010 • the ADO.NET Entity Framework (as well as LINQ to EF) • the expansion of the Windows Presentation Foundation (WPF) API • improved COM interop the and the If you’re checking out this book for the first time, understand that it targets experienced software professionals and students of computer science—so please don’t expect three chapters devoted to “variable scope” here! The P. .NET 4 Platform mission of this text is to provide you with a rock-solid foundation in the VB N programming language (including a full discussion of OOP) and the critical l aspects of the .NET 4 platform. aE Once you digest the information presented in the book you hold in your t hands, you’ll be in a perfect position to apply this knowledge to your specific T Vidya Vrat Agarwal, Author of programming assignments, and you’ll be well-equipped to explore the .NET f Pro ASP.NET 3.5 in VB 2008 universe on your own terms. o Beginning C# 2008 Databases 4 Andrew Troelsen and Vidya Vrat Agarwal r Beginning VB 2008 Databases m Exploring the .NET universe with Companion eBook THE APRESS ROADMAP Pro Pro Visual Basic 2010 VB 2010 and the Windows Azure .NET 4 Platform Introducing Pro See last page for details .NET 4.0 ASP.NET 4 in VB 2010 on $10 eBook version Pro Pro Dynamic WPF in VB 2010 .NET 4.0 Applications AT Andrew Troelsen Vidya Vrat Agarwal SOURCE CODE ONLINE gro and www.apress.com ae ISBN 978-1-4302-2985-8 rl ws 55999 e a n US $59.99 l Shelve in: Programming/VB User level: Intermediate–Advanced 9 781430 229858 this print for content only—size & color not accurate spine = 2.15625" 1800 page count 840 PPI Pro VB 2010 and the .NET 4 Platform ■ ■ ■ Andrew Troelsen and Vidya Vrat Agarwal Pro VB 2010 and the .NET 4 Platform Copyright © 2010 by Andrew Troelsen and Vidya Vrat Agarwal All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-13 (pbk): 978-1-4302-2985-8 ISBN-13 (electronic): 978-1-4302-2986-5 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. President and Publisher: Paul Manning Lead Editor: Ewan Buckingham Technical Reviewer: Andy Olsen Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell, Jonathan Gennick, Jonathan Hassell, Michelle Lowman, Matthew Moodie, Duncan Parkes, Jeffrey Pepper, Frank Pohlmann, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Coordinating Editor: Debra Kelly Copy Editors: Mary Behr, Patrick Meader, Katie Stence, and Sharon Terdeman Production Support: Patrick Cunningham Indexer: BIM Indexing & Proofreading Services Artist: April Milne Cover Designer: Anna Ishchenko Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail [email protected], or visit www.springeronline.com. For information on translations, please e-mail [email protected], or visit www.apress.com. Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at www.apress.com/info/bulksales. The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. The source code for this book is available to readers at www.apress.com. To the memory of my wonderful grandmother, Maxine. I love you, Gerta. Rest peacefully. –Andrew Troelsen To my lovely wife, sweet daughters, and my parents. I love you all. –Vidya Vrat Agarwal Contents at a Glance About the Authors ..................................................................................................... liv About the Technical Reviewer ................................................................................... lv Acknowledgments .................................................................................................... lvi Introduction ............................................................................................................. lvii ■ Chapter 1: Introducing VB 2010 .............................................................................. 1 ■ Chapter 2: Building Visual Basic 2010 Applications ............................................. 41 ■ Chapter 3: Core VB 2010 Programming Constructs, Part I .................................... 71 ■ Chapter 4: Core VB 2010 Programming Constructs, Part II ................................. 125 ■ Chapter 5: Defining Encapsulated Class Types .................................................... 169 ■ Chapter 6: Understanding Inheritance and Polymorphism .................................. 227 ■ Chapter 7: Understanding Structured Exception Handling .................................. 273 ■ Chapter 8: Understanding Object Lifetime ........................................................... 303 ■ Chapter 9: Working with Interfaces ..................................................................... 333 ■ Chapter 10: Understanding Generics ................................................................... 375 ■ Chapter 11: Delegates, Events, and Lambdas ..................................................... 415 ■ Chapter 12: Advanced VB 2010 Language Features ............................................ 461 ■ Chapter 13: LINQ to Objects ................................................................................. 507 ■ Chapter 14: Configuring .NET Assemblies ........................................................... 543 ■ Chapter 15: Type Reflection, Late Binding, ■ and Attribute-Based Programming ..................................................................... 605 iv C ■ONTENTS AT A GLANCE ■ Chapter 16: Processes, AppDomains, and Object Contexts ................................. 653 ■ Chapter 17: Understanding CIL and the Role of Dynamic Assemblies ................. 687 ■ Chapter 18: Dynamic Types and the Dynamic Language Runtime ...................... 739 ■ Chapter 19: Multithreaded and Parallel Programming ........................................ 765 ■ Chapter 20: File I/O and Object Serialization ....................................................... 817 ■ Chapter 21: ADO.NET Part I: The Connected Layer .............................................. 869 ■ Chapter 22: ADO.NET Part II: The Disconnected Layer ......................................... 931 ■ Chapter 23: ADO.NET Part III: The Entity Framework .......................................... 999 ■ Chapter 24: Introducing LINQ to XML ................................................................ 1041 ■ Chapter 25: Introducing Windows Communication Foundation ........................ 1061 ■ Chapter 26: Introducing Windows Workflow Foundation 4.0 ............................ 1127 ■ Chapter 27: Introducing Windows Presentation Foundation and XAML ............ 1165 ■ Chapter 28: Programming with WPF Controls ................................................... 1227 ■ Chapter 29: WPF Graphics Rendering Services ................................................. 1295 ■ Chapter 30: WPF Resources, Animations, and Styles ........................................ 1335 ■ Chapter 31: WPF Control Templates and UserControls ...................................... 1377 ■ Chapter 32: Building ASP.NET Web Pages ......................................................... 1427 ■ Chapter 33: ASP.NET Web Controls, Master Pages, and Themes ...................... 1477 ■ Chapter 34: ASP.NET State Management Techniques ....................................... 1523 ■ Appendix A: Programming with Windows Forms .............................................. 1561 ■ Appendix B: Platform-Independent .NET Development with Mono .................... 1613 Index ..................................................................................................................... 1635 v Contents About the Authors ..................................................................................................... liv About the Technical Reviewer ................................................................................... lv Acknowledgments .................................................................................................... lvi Introduction ............................................................................................................. lvii ■ Chapter 1: Introducing VB 2010 .............................................................................. 1 Understanding the Previous State of Affairs ...................................................................... 1 Life As a C/Windows API Programmer ...................................................................................................... 1 Life As a C++/MFC Programmer .............................................................................................................. 2 Life As a Visual Basic 6.0 Programmer ..................................................................................................... 2 Life As a Java Programmer ...................................................................................................................... 3 Life As a COM Programmer ...................................................................................................................... 3 The .NET Solution .............................................................................................................. 4 Introducing the Building Blocks of the .NET Platform (the CLR, CTS, and CLS) ................. 5 The Role of the Base Class Libraries ........................................................................................................ 6 What Visual Basic 2010 Brings to the Table ............................................................................................. 6 Additional .NET-Aware Programming Languages .............................................................. 8 Life in a Multi-Language World .............................................................................................................. 10 An Overview of .NET Assemblies ..................................................................................... 10 Single-File and Multi-File Assemblies .................................................................................................... 12 The Role of the Common Intermediate Language .................................................................................. 12 The Role of .NET Type Metadata ............................................................................................................. 15 The Role of the Assembly Manifest ........................................................................................................ 17 vi ■ CONTENTS Understanding the Common Type System ....................................................................... 18 CTS Class Types ..................................................................................................................................... 18 CTS Interface Types ................................................................................................................................ 19 CTS Structure Types ............................................................................................................................... 19 CTS Enumeration Types .......................................................................................................................... 20 CTS Delegate Types ................................................................................................................................ 20 CTS Type Members ................................................................................................................................. 21 Intrinsic CTS Data Types ......................................................................................................................... 21 Understanding the Common Language Specification ...................................................... 22 Ensuring CLS Compliance ....................................................................................................................... 24 Understanding the Common Language Runtime ............................................................. 24 The Assembly/Namespace/Type Distinction ................................................................... 26 The Role of the Microsoft Root Namespace ........................................................................................... 29 Accessing a Namespace Programmatically ........................................................................................... 29 Referencing External Assemblies ........................................................................................................... 31 Exploring an Assembly Using ildasm.exe ........................................................................ 32 Viewing CIL Code .................................................................................................................................... 33 Viewing Type Metadata .......................................................................................................................... 34 Viewing Assembly Metadata (aka the Manifest) .................................................................................... 34 Exploring an Assembly Using Reflector ........................................................................... 35 Deploying the .NET Runtime ............................................................................................ 37 The .NET Client Profile Runtime .............................................................................................................. 37 The Platform-Independent Nature of .NET ....................................................................... 37 Summary ......................................................................................................................... 39 ■ Chapter 2: Building Visual Basic 2010 Applications ............................................. 41 The Role of the .NET Framework 4.0 SDK ....................................................................... 41 The Visual Studio 2010 Command Prompt ............................................................................................. 42 vii ■ CONTENTS Building VB 2010 Applications Using vbc.exe .................................................................. 43 Specifying Input and Output Targets ...................................................................................................... 44 Referencing External Assemblies ........................................................................................................... 45 Referencing Multiple External Assemblies ............................................................................................. 46 Compiling Multiple Source Files ............................................................................................................. 46 Working with VB 2010 Response Files ................................................................................................... 47 Building .NET Applications Using Notepad++ ................................................................. 49 Building .NET Applications Using Visual Basic 2010 Express .......................................... 50 Some Unique Features of Visual Basic 2010 Express ............................................................................ 51 Building .NET Applications Using Visual Studio 2010 ...................................................... 52 Some Unique Features of Visual Studio 2010 ......................................................................................... 53 Targeting the .NET Framework Using the New Project Dialog Box ........................................................ 53 Using the Solution Explorer Utility .......................................................................................................... 54 The Class View Utility ............................................................................................................................. 57 The Object Browser Utility ...................................................................................................................... 58 Integrated Support for Code Refactoring ................................................................................................ 59 Code Expansions Techniques ................................................................................................................. 61 The Visual Class Designer ...................................................................................................................... 62 The Integrated .NET Framework 4.0 SDK Documentation System ......................................................... 68 Summary ......................................................................................................................... 70 ■ Chapter 3: Core VB 2010 Programming Constructs, Part I .................................... 71 The Role of the Module Type ........................................................................................... 71 Projects with Multiple Modules .............................................................................................................. 73 Modules Are Not Creatable ..................................................................................................................... 74 Renaming Your Initial Module ................................................................................................................. 75 Members of Modules .............................................................................................................................. 75 viii

Description:
Be the first to understand .NET 4.0 and Visual Basic 2010. Pro VB 2010 and the .NET 4.0 Platform provides developers with a complete guide to the new technology, explaining the importance of all the key VB 2010 language features. This edition has been comprehensively revised and rewritten to make it
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.