pro vb 2010 and the .net 4.0 platform

1.8K 25.8K 0
pro vb 2010 and the .net 4.0 platform

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

this print for content only—size & color not accurate Troelsen Agarwal   CYAN   MAGENTA   YELLOW   BLACK   PANTONE 123 C Companion eBook Available BOOKS FOR PROFESSIONALS BY PROFESSIONALS ® Pro VB 2010 and the .NET 4 Platform Dear Reader, With the core VB language stable, the 4th edition of the .NET platform has brought with it a massive wealth of new functionality. The new edition of this book is your guide to learning the ins and outs of the .NET 4 platform and Visual Studio 2010, including: • the Dynamic Language Runtime (DLR) • the Task Parallel Library (TPL, including PLINQ) • the completely revamped WF 4 API • the ADO.NET Entity Framework (as well as LINQ to EF) • the expansion of the Windows Presentation Foundation (WPF) API • improved COM interop 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 mission of this text is to provide you with a rock-solid foundation in the VB programming language (including a full discussion of OOP) and the critical aspects of the .NET 4 platform. Once you digest the information presented in the book you hold in your hands, you’ll be in a perfect position to apply this knowledge to your specific programming assignments, and you’ll be well-equipped to explore the .NET universe on your own terms. Andrew Troelsen and Vidya Vrat Agarwal US $59.99 Shelve in: Programming/VB User level: Intermediate–Advanced THE APRESS ROADMAP Pro ASP.NET 4 in VB 2010 Introducing .NET 4.0 Pro Windows Azure Pro Dynamic .NET 4.0 Applications Pro VB 2010 and the .NET 4 Platform Pro WPF in VB 2010 www.apress.com SOURCE CODE ONLINE Companion eBook See last page for details on $10 eBook version ISBN 978-1-4302-2985-8 9 781430 229858 5 59 9 9 Vidya Vrat Agarwal, Author of Pro ASP.NET 3.5 in VB 2008 Beginning C# 2008 Databases Beginning VB 2008 Databases spine = 2.15625" 1800 page count 840 PPI THE EXPERT’S VOICE ®  IN .NET Pro VB 2010 .NET 4 Platform Andrew Troelsen and Vidya Vrat Agarwal Exploring the .NET universe with Visual Basic 2010 and the VB Pro 2010 and the .NET 4 Platform Andrew Troelsen, Author of Pro C# 2010 and the .NET 4 Platform Pro VB 2008 and the .NET 3.5 Platform Pro Expression Blend 4 Expert ASP.NET 2.0 Advanced Application Design www.it-ebooks.info www.it-ebooks.info Pro VB 2010 and the .NET 4 Platform ■ ■ ■ Andrew Troelsen and Vidya Vrat Agarwal www.it-ebooks.info 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 orders-ny@springer-sbm.com, or visit www.springeronline.com. For information on translations, please e-mail rights@apress.com, 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. www.it-ebooks.info 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 www.it-ebooks.info iv 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 www.it-ebooks.info ■ CONTENTS AT A GLANCE v ■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 www.it-ebooks.info vi 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 www.it-ebooks.info ■ CONTENTS vii 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 www.it-ebooks.info ■ CONTENTS viii 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 www.it-ebooks.info [...]... IDbConnection Interface 878 The Role of the IDbTransaction Interface 878 The Role of the IDbCommand Interface 878 The Role of the IDbDataParameter and IDataParameter Interfaces 879 The Role of the IDbDataAdapter and IDataAdapter Interfaces 880 The Role of the IDataReader and IDataRecord Interfaces 880 Abstracting Data Providers Using Interfaces ... 653 The Role of a Windows Process 653 The Role of Threads 654 Interacting with Processes Under the NET Platform 656 Enumerating Running Processes 658 Investigating a Specific Process 660 Investigating a Process’s Thread Set 660 Investigating a Process’s Module Set 663 Starting and Stopping Processes Programmatically... in VB 2010 739 The Role of Dynamic Typing in VB 2010 740 Calling Members on Dynamically Declared Data 742 The Role of the Microsoft.VisualBasic.dll Assembly 743 The Scope of the Dynamic Objects 744 xxvii www.it-ebooks.info ■ CONTENTS Limitations of the Dynamic Type 745 Practical Uses of the Dynamic Types 746 The Role of the. .. using VB 2010 Language Features 756 COM Interop without VB 2010 Language Features 760 Summary 762 ■Chapter 19: Multithreaded and Parallel Programming 765 The Process/AppDomain/Context/Thread Relationship 765 The Problem of Concurrency 767 The Role of Thread Synchronization 767 A Brief Review of the NET Delegate 767 The. .. 798 Programming with Timer Callbacks 798 Understanding the CLR ThreadPool 800 Parallel Programming under the NET Platform 802 The Task Parallel Library API 802 The Role of the Parallel Class 804 Understanding Data Parallelism 804 The Task Class 806 Handling Cancelation Request 807 Understanding Task... 871 Understanding ADO.NET Data Providers 871 The Microsoft-Supplied ADO.NET Data Providers 873 A Word Regarding System.Data.OracleClient.dll 875 Obtaining Third-Party ADO.NET Data Providers 875 Additional ADO.NET Namespaces 875 xxxi www.it-ebooks.info ■ CONTENTS The Types of the System.Data Namespace 876 The Role of the IDbConnection... Defining Modules in VB 2010 190 Defining the Pillars of OOP 193 The Role of Encapsulation 193 The Role of Inheritance 194 The Role of Polymorphism 195 VB 2010 Access Modifiers 197 The Default Access Modifiers 197 Access Modifiers and Nested Types 198 The First Pillar: VB 2010 Encapsulation Services... 729 Emitting the Assembly and Module Set 732 The Role of the ModuleBuilder Type 733 Emitting the HelloClass Type and the String Member Variable 734 Emitting the Constructors 735 Emitting the SayHello() Method 736 Using the Dynamically Generated Assembly 736 Summary 738 ■Chapter 18: Dynamic Types and the Dynamic Language... Visual Studio 2010 249 NotOverridable Members 250 Understanding Abstract Classes and the MustInherit Keyword 250 xiii www.it-ebooks.info ■ CONTENTS Understanding the Polymorphic Interface 252 Understanding Member Shadowing 257 Understanding Base Class/Derived Class Casting Rules 259 The VB TryCast Keyword 262 The VB Is Keyword... Creating the AutoLot Database 885 Creating the Inventory Table 885 Authoring the GetPetName() Stored Procedure 888 Creating the Customers and Orders Tables 889 Visually Creating Table Relationships 891 The ADO.NET Data Provider Factory Model 892 A Complete Data Provider Factory Example 893 A Potential Drawback with the Provide . count 8 40 PPI THE EXPERT’S VOICE ®  IN  .NET Pro VB 201 0 .NET 4 Platform Andrew Troelsen and Vidya Vrat Agarwal Exploring the .NET universe with Visual Basic 201 0 and the VB Pro 201 0 and the .NET. Pro VB 201 0 and the .NET 4 Platform ■ ■ ■ Andrew Troelsen and Vidya Vrat Agarwal www.it-ebooks.info Pro VB 201 0 and the .NET 4 Platform Copyright © 201 0 by Andrew. the VB Pro 201 0 and the .NET 4 Platform Andrew Troelsen, Author of Pro C# 201 0 and the .NET 4 Platform Pro VB 200 8 and the .NET 3.5 Platform Pro Expression Blend 4 Expert ASP .NET 2 .0 Advanced Application

Ngày đăng: 01/08/2014, 16:35

Từ khóa liên quan

Mục lục

  • Prelim

  • Contents at a Glance

  • Contents

  • About the Authors

  • About the Technical Reviewer

  • Acknowledgments

  • Introduction

    • We’re a Team, You and I

    • An Overview of This Book

      • Chapter 1: Introducing VB 2010

      • Chapter 2: Building Visual Basic 2010 Applications

      • Chapter 3: Core VB 2010 Programming Constructs, Part I

      • Chapter 4: Core VB Programming Constructs, Part II

      • Chapter 5: Defining Encapsulated Class Types

      • Chapter 6: Understanding Inheritance and Polymorphism

      • Chapter 7: Understanding Structured Exception Handling

      • Chapter 8: Understanding Object Lifetime

      • Chapter 9: Working with Interfaces

      • Chapter 10: Understanding Generics

      • Chapter 11: Delegates, Events, and Lambdas

      • Chapter 12: Advanced VB 2010 Language Features

      • Chapter 13: LINQ to Objects

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan