Copyright
Library of Congress Cataloging-in-Publication Data
A catalog record for this book can be obtained from the Library of Congress
Editorial/Production Supervision: Nicholas Radhuber
Acquisitions Editor: Jill Harry
Marketing Manager: Dan DePasquale
Manufacturing Buyer: Maura Zaldivar
Cover Design: Anthony Gemmellaro
Cover Design Direction: Jerry Votta
Interior Series Design: Gail Cocker-Bogusz
2003 Pearson Education, Inc.
Publishing as Prentice Hall Professional Technical Reference
Upper Saddle River, NJ 07458
Prentice Hall books are widely used by corporations and government agencies for training, marketing, and resale.
The publisher offers discounts on this book when ordered in bulk quantities. For more information, contact Corporate Sales Department, phone: 800-382-3419; fax: 201-236-7141; email:
Or write Corporate Sales Department, Prentice Hall PTR, One Lake Street, Upper Saddle River, NJ 07458.
Product and company names mentioned herein are the trademarks or registered trademarks of their respective owners.
All rights reserved. No part of this book may be reproduced, in any form or by any means, without permission in writing from the publisher.
Printed in the United States of America
10 9 8 7 6 5 4 3 2 1
Pearson Education LTD.
Pearson Education Australia PTY, Limited
Pearson Education Singapore, Pte. Ltd.
Pearson Education North Asia Ltd.
Pearson Education Canada, Ltd.
Pearson Educacin de Mexico, S.A. de C.V.
Pearson Education Japan
Pearson Education Malaysia, Pte. Ltd.
The Integrated .NET Series From Object Innovations and Prentice Hall PTR
C#
Interoperability and Migration
XML Programming Using .NET and Java
Chiang/Singh
The .NET and COM Interoperability Handbook
Gordon
Migrating to .NET: A Pragmatic Path to VB.NET, Visual C++ .NET, and ASP.NET
Katre/Halari/Surapaneni/Gupta/Deshpande
PERL
Visual Basic
Developing Windows Applications Using Visual Basic .NET
Kanetkar/Manickam/Wyatt
Application Development Using Visual Basic and .NET
Oberg/Thorsteinson/Wyatt
Introduction to Visual Basic Using .NET
Wyatt/Oberg
Visual C++
Web Applications
Fundamentals of Web Applications Using .NET and XML
Bell/Feng/Soong/Zhang/Zhu
Mobile Application Development Using .NET
Kuman/Maheshwari/Ramadurai
.NET Security and Crytography
Thornsteinson
Developing Web Applications Using ASP.NET and VB.NET
Joshi/Ganesh/Kumar/Menaker
About Prentice Hall Professional Technical Reference
With origins reaching back to the industry's first computer science publishing program in the 1960s, and formally launched as its own imprint in 1986, Prentice Hall Professional Technical Reference (PH PTR) has developed into the leading provider of technical books in the world today. Our editors now publish over 200 books annually, authored by leaders in the fields of computing, engineering, and business.
Our roots are firmly planted in the soil that gave rise to the technical revolution. Our bookshelf contains many of the industry's computing and engineering classics: Kernighan and Ritchie's C Programming Language , Nemeth's UNIX System Adminstration Handbook , Horstmann's Core Java , and Johnson's High-Speed Digital Design .
PH PTR acknowledges its auspicious beginnings while it looks to the future for inspiration. We continue to evolve and break new ground in publishing by providing today's professionals with tomorrow's solutions.
Preface
At the company for which I work we have just begun the process of planning our migration to .NET. This process has been fraught with both political and technical challenges. The purpose of this book is to help you with the technical challenges of .NET migration, in particular using COM Interop. The only help I can give you on the political challenges is: Beware of people who want to use .NET just because it's cool, because Microsoft says you should, or to pad their resume. Also, beware of people who don't want to use .NET because of personal biases against Microsoft. Decisions about what technologies should be used should be based on business objectives first, customer satisfaction second, and ease of development and maintenance third. Other agendas must be brushed aside.
But enough about politics, this is a technical book with a target audience of intermediate to advanced COM/COM+ programmers who are looking to make the move to .NET. I assume some knowledge of COM and COM+, but I don't assume any prior knowledge of .NET. This book also functions as a .NET tutorial for COM programmers. I start from first principles defining at an advanced level all of the technologies in the .NET Framework. I have included chapters on the CLR, a one-chapter tutorial on the C# programming language, and chapters on .NET Web Services, and .NET Remoting. All of these chapters are there to provide you with the foundational knowledge that you need to understand the meat of the book, which is the pure Interop material in , which cover advanced topics in Interop, are particularly beefy chapters.
My pedagogical style in writing is similar to the teaching style that I have used at UCLA Extension. My approach when teaching new concepts is as follows:
Explain why it is important for the reader to learn the new concept? What problem does the new concept solve? Why should the reader care about it?
Explain the concept, in theory first, using copious analogies and diagrams.
Have the student use the concepts and theories they have just learned in a hands-on demonstration. The demonstration does not have to be complicated; it just has to illustrate the concept that the student is trying to learn.
Summarize what the reader should have just learned.
Along the way, point the reader to additional resources to consult for further information.
Most of the chapters start by explaining the problem that the .NET technology that you are about to learn about will solve. Next we discuss how this .NET-related technology works and how you will use it. You will find lots of analogies, diagrams and screen shots. Finally, in most of the chapters we will build a demonstration program. I don't think any of the demonstration programs are terribly sophisticated (they weren't meant to be). The example programs are designed to reinforce the topic in that chapter. I show you how to build the example program in enough detail that a beginning C# programmer should have no problem following along. I think you will learn the most by following along and building the example programs yourself, but if you don't want to go through the steps yourself, you can download the demonstration programs from the Web site for this book. The URL for the Web site is: www.objectinnovations.com/dotnet.htm. A link is provided at that Web site for downloading the sample programs for this book.
The sample programs are provided in a self-extracting file. When expanded, a directory structure is created, rooted in c:\OI\NetCom. The sample programs are in directories Chap01, Chap02, and so on. All the samples for a given chapter are in individual folders within the chapter directories. The names of the folders are clearly identified in the text. This book is part of the Integrated .NET Series. The sample programs for other books in the series are located in their own directories underneath c:\OI, so all the .NET examples from all books in the series will be located in a common area as you install them.