C# 2008 For Dummies
by Chuck Sphar and Stephen Randy Davis
C# 2008 For Dummies
Published by
Wiley Publishing, Inc.
111 River Street
Hoboken, NJ 07030-5774
www.wiley.com
Copyright 2008 by Wiley Publishing, Inc., Indianapolis, Indiana
Published by Wiley Publishing, Inc., Indianapolis, Indiana
Published simultaneously in Canada
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4355, or online at http://www.wiley.com/go/permissions.
Trademarks: Wiley, the Wiley Publishing logo, For Dummies, the Dummies Man logo, A Reference for the Rest of Us!, The Dummies Way, Dummies Daily, The Fun and Easy Way, Dummies.com, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc., and/or its affiliates in the United States and other countries, and may not be used without written permission. All other trademarks are the property of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book.
LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional assistance is required, the services of a competent professional person should be sought. Neither the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Website is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or Website may provide or recommendations it may make. Further, readers should be aware that Internet Websites listed in this work may have changed or disappeared between when this work was written and when it is read.
For general information on our other products and services, please contact our Customer Care Department within the U.S. at 877-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002.
For technical support, please visit www.wiley.com/techsupport.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books.
Library of Congress Control Number: 2008920770
ISBN: 978-0-470-19109-5
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
About the Authors
Stephen R. Davis, who goes by the name of Randy, lives with his wife and son near Dallas, Texas. He and his family have written numerous books, including C++ For Dummies and C++ Weekend Crash Course. Stephen works for L-3 Communications.
Chuck Sphar escaped Microsofts C++ documentation camps in 1997, after six years hard labor as a senior technical writer. Hes perpetrated three previous tomes, one on object-oriented programming for the Mac, one on Microsofts MFC class library, and C# 2005 For Dummies, a revision of Randys original edition. Hes currently finishing a novel about ancient Rome (againstrome.com) and gobbling great mouthfuls of .NET programming. Chuck can be reached for praise and minor nits at chuck@csharp102.info.
Dedications
For a remarkable woman and great friend, Helen Tross and, of course, as always, my Pam Chuck Sphar
Authors Acknowledgments
As always, thanks to my agent, Claudette Moore, who brought the book to me in 2005. I also want to thank Randy Davis for being willing to hand over his baby to a guy he didnt know. Id have found that very hard, and I hope Ive done justice in two revisions of his original edition.
Many thanks are due as well to the fine folks at Wiley, starting with Acquisitions Editor Katie Feltman and Project Editor Pat OBrien. Id also like to thank Barry Childs-Helton for much of the books consistency, and the art, media, technical, and other production folks who turn my files into a real book.
The most heartfelt thanks are due to Pam for constant encouragement and much enabling. Shes my partner in all things. Chuck Sphar
Publishers Acknowledgments
Were proud of this book; please send us your comments through our online registration form located at www.dummies.com/register/.
Some of the people who helped bring this book to market include the following:
Acquisitions, Editorial, and Media Development
Project Editor: Pat OBrien
Acquisitions Editor: Katie Feltman
Senior Copy Editor: Barry Childs-Helton
Technical Editor: Roy El-Rayes
Editorial Manager: Kevin Kirschner
Media Development Manager: Laura VanWinkle
Editorial Assistant: Amanda Foxworth
Sr. Editorial Assistant: Cherie Case
Cartoons: Rich Tennant (www.the5thwave.com)
Composition Services
Project Coordinator: Kristie Rees
Layout and Graphics: Stacie Brooks, Carl Byers, Reuben W. Davis, Shane Johnson, Christine Williams
Proofreader: Christine Sabooni
Indexer: Potomac Indexing, LLC
Publishing and Editorial for Technology Dummies
Richard Swadley, Vice President and Executive Group Publisher
Andy Cummings, Vice President and Publisher
Mary Bednarek, Executive Acquisitions Director
Mary C. Corder, Editorial Director
Publishing for Consumer Dummies
Diane Graves Steele, Vice President and Publisher
Joyce Pepple, Acquisitions Director
Composition Services
Gerry Fahey, Vice President of Production Services
Debbie Stailey, Director of Composition Services
Introduction
T his edition of C# 2008 for Dummies represents a pretty thorough over-haul. It adds tons of new material, an improved organization, and many new example programs. So even if youve seen the book before, its worth another look.