Contents

About the Author xix

About the Technical Reviewer xix

Acknowledgments xx

Introduction and Welcome xxi part 1 ■ ■ ■ Introducing Visual Basic 2008 and the .NET Platform

CHAPTER 1 The Philosophy of .NET 3

Understanding the Previous State of Affairs 3

The .NET Solution 6

Introducing the Building Blocks of the .NET Platform

What Visual Basic 2008 Brings to the Table 7

Additional .NET-Aware Programming Languages 9

An Overview of .NET Assemblies 10

Understanding the Common Type System 16

Understanding the Common Language Specification 19

Understanding the Common Language Runtime 21

The Assembly/Namespace/Type Distinction 22

Using ildasm.exe 27

Using Lutz Roeder's Reflector 30

Deploying the .NET Runtime 30

The Platform-Independent Nature of .NET 31

Summary 32

chapter 2 Building Visual Basic 2008 Applications 35

The Role of the .NET Framework 3.5 SDK 35

The VB 2008 Command-Line Compiler (vbc.exe) 36

Building VB 2008 Applications Using vbc.exe 37

Working with vbc.exe Response Files 40

Building .NET Applications Using SharpDevelop 43

Building .NET Applications Using Visual Basic 2008 Express 46

Building .NET Applications Using Visual Studio 2008 47

The Role of the Visual Basic 6.0 Compatibility Assembly 59

A Partial Catalog of Additional .NET Development Tools 61

Summary 61

part 2 ■ ■ ■ Core VB Programming Constructs chapter 3 VB 2008 Programming Constructs, Part I 65

The Role of the Module Type 65

The Role of the Main Method 69

An Interesting Aside: Some Additional Members of the

System.Environment Class 72

The System.Console Class 73

System Data Types and VB Shorthand Notation 77

Understanding the System.String Type 83

Narrowing (Explicit) and Widening (Implicit) Data Type Conversions 89

Building Visual Basic 2008 Code Statements 94

VB 2008 Flow-Control Constructs 96

VB 2008 Iteration Constructs 99

Summary 102

chapter 4 VB 2008 Programming Constructs, Part II 103

Defining Subroutines and Functions 103

Understanding Member Overloading 111

Array Manipulation in VB 2008 113

Understanding VB 2008 Enumerations 120

Introducing the VB 2008 Structure Type 126

Summary 128

chapter 5 Designing Encapsulated Class Types 129

Introducing the VB 2008 Class Type 129

Understanding Class Constructors 133

The Role of the Me Keyword 137

Understanding the Shared Keyword 142

Defining the Pillars of OOP 148

Visual Basic 2008 Access Modifiers 151

The First Pillar: VB 2008's Encapsulation Services 154

Understanding Constant Data 161

Understanding Read-Only Fields 163

Understanding Partial Type Definitions 164

Documenting VB 2008 Source Code via XML 165

Visualizing the Fruits of Our Labor 170

Summary 171

chapter 6 Understanding Inheritance and Polymorphism 173

The Basic Mechanics of Inheritance 173

Revising Visual Studio 2008 Class Diagrams 177

The Second Pillar: The Details of Inheritance 178

Programming for Containment/Delegation 184

The Third Pillar: VB 2008's Polymorphic Support 187

Understanding Base Class/Derived Class Casting Rules 198

The Master Parent Class: System.Object 200

Summary 206

chapter 7 Understanding Structured Exception Handling 207

Ode to Errors, Bugs, and Exceptions 207

The Role of .NET Exception Handling 208

The Simplest Possible Example 210

Configuring the State of an Exception 214

System-Level Exceptions (System.SystemException) 218

Application-Level Exceptions (System.ApplicationException) 219

Processing Multiple Exceptions 222

The Finally Block 226

Who Is Throwing What? 227

The Result of Unhandled Exceptions 228

Debugging Unhandled Exceptions Using Visual Studio 2008 228

Blending VB6 Error Processing and Structured Exception Handling 230

Summary 230

chapter 8 Understanding Object Lifetime 233

Classes, Objects, and References 233

The Basics of Object Lifetime 234

The Role of Application Roots 237

Understanding Object Generations 239

The System.GC Type 240

Building Finalizable Objects 243

Building Disposable Objects 246

Building Finalizable and Disposable Types 248

Summary 251

Was this article helpful?

0 0

Post a comment