Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals.
The .NET logo is either a registered trademark or trademark of Microsoft Corporation in the United States and/or other countries and is used under license from Microsoft.
The author and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein.
The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests. For more information, please contact:
U.S. Corporate and Government Sales
For sales outside the United States please contact:
Visit us on the Web: www.awprofessional.com
Library of Congress Cataloging-in-Publication Data:
Essential C# 2.0 / Mark Michaelis.
ISBN 0-321-15077-5 (pbk. : alk. paper)
1. C# (Computer program language) I. Title.
Copyright © 2007 Pearson Education, Inc.
All rights reserved. Printed in the United States of America. This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permissions, write to:
Pearson Education, Inc.
Rights and Contracts Department
75 Arlington Street, Suite 300
Boston, MA 02116
Fax: (617) 848-7047
Text printed in the United States on recycled paper at Courier in Stoughton, Massachusetts. First printing, July 2006
To my family: Elisabeth, Benjamin, Hanna, and Abigail.
Microsoft .NET Development Series
John Montgomery, Series Advisor
Don Box, Series Advisor
Martin Heller, Series Editor
The Microsoft .NET Development Series is supported and developed by the leaders and experts of Microsoft development technologies including Microsoft architects and DevelopMentor instructors. The books in this series provide a core resource of information and understanding every developer needs in order to write effective applications and managed code. Learn from the leaders how to maximize your use of the .NET Framework and its programming languages.
Titles in the Series
Brad Abrams, .NET Framework Standard Library Annotated Reference Volume 1: Base Class Library and Extended Numerics Library, 0-321-15489-4
Christian Nagel, Enterprise Services with the .NET Framework: Developing Distributed Business Solutions with .NET Enterprise Services, 0-321-24673-X
Brad Abrams and Tamara Abrams, .NET Framework Standard Library Annotated Reference, Volume 2: Networking Library, Reflection Library, and XML Library, 0-321-19445-4
Brian Noyes, Data Binding with Windows Forms 2.0: Programming Smart Client Data Applications with .NET, 0-321-26892-X
Fritz Onion, Essential ASP.NET with Examples in C#, 0-201-76040-1
Keith Ballinger, .NET Web Services: Architecture and Implementation, 0-321-11359-4
Fritz Onion, Essential ASP.NET with Examples in Visual Basic .NET, 0-201-76039-8
Bob Beauchemin, Niels Berglund, Dan Sullivan, A First Look at SQL Server 2005 for Developers, 0-321-18059-3
Ted Pattison and Dr. Joe Hummel, Building Applications and Components with Visual Basic .NET, 0-201-73495-8
Don Box with Chris Sells, Essential . NET, Volume 1: The Common Language Runtime, 0-201-73411-7
Dr. Neil Roodyn, eXtreme .NET: Introducing eXtreme Programming Techniques to .NET Developers, 0-321-30363-6
Keith Brown, The .NET Developer's Guide to Windows Security, 0-321-22835-9
Chris Sells, Windows Forms Programming in C#, 0-321-11620-8
Eric Carter and Eric Lippert, Visual Studio Tools for Office: Using C# with Excel, Word, Outlook, and InfoPath, 0-321-33488-4
Chris Sells and Justin Gehtland, Windows Forms Programming in Visual Basic .NET, 0-321-12519-3
Eric Carter and Eric Lippert, Visual Studio Tools for Office: Using Visual Basic 2005 with Excel, Word, Outlook, and InfoPath, 0-321-41175-7
Paul Vick, The Visual Basic .NET Programming Language, 0-321-16951-4
Mahesh Chand, Graphics Programming with GDI+, 0-321-16077-0
Damien Watkins, Mark Hammond, Brad Abrams, Programming in the .NET Environment, 0-201-77018-0
Krzysztof Cwalina and Brad Abrams, Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries, 0-321-24675-6
Shawn Wildermuth, Pragmatic ADO.NET: Data Access for the Internet World, 0-201-74568-2
Paul Yao and David Durant, .NET Compact Framework Programming with C#, 0-321-17403-8
Anders Hejlsberg, Scott Wiltamuth, Peter Golde, The C# Programming Language, 0-321-15491-6
Paul Yao and David Durant, .NET Compact Framework Programming with Visual Basic .NET, 0-321-17404-6
Alex Homer, Dave Sussman, Mark Fussell, ADO.NET and System.Xml v. 2.0The Beta Version, 0-321-24712-4
Alex Homer, Dave Sussman, Rob Howard, ASP.NET v. 2.0The Beta Version, 0-321-25727-8
James S. Miller and Susann Ragsdale, The Common Language Infrastructure Annotated Standard, 0-321-15493-2