Copyright © 2000 by Sams Publishing
All rights reserved. No part of this book shall be reproduced, stored in aretrieval system, or transmitted by any means, electronic, mechanical,photocopying, recording, or otherwise, without written permission from thepublisher. No patent liability is assumed with respect to the use of theinformation contained herein. Although every precaution has been taken in thepreparation of this book, the publisher and author assume no responsibility forerrors or omissions. Nor is any liability assumed for damages resulting from theuse of the information contained herein.
International Standard BookNumber: 0-672-32037-1
Library of Congress Catalog Card Number:00-105188
Printed in the United States of America
First Printing:July 2000
02 01 00 4 3 2 1
All terms mentioned in this book that are known to be trademarks or servicemarks have been appropriately capitalized. Sams Publishing cannot attest to theaccuracy of this information. Use of a term in this book should not be regardedas affecting the validity of any trademark or service mark.
Warning and Disclaimer
Every effort has been made to make this book as complete and as accurate aspossible, but no warranty or fitness is implied. The information provided is onan "as is" basis. The author and the publisher shall have neitherliability nor responsibility to any person or entity with respect to any loss ordamages arising from the information contained in this book.
Welcome to Presenting C#. This book is your ticket to quickly getting up to speed with the enterprise programming language that ships with the Common Language Runtime (CLR): C# (pronounced C sharp).
The Next Generation Windows Services Runtime is a runtime environment that not only manages the execution of code, but also provides services that make programming easier. Compilers produce managed code to target this managed execution environment. You get cross-language integration, cross-language exception handling, enhanced security, versioning and deployment support, and debugging and profiling services for free.
The premier language for the CLR is C#. Much of the supporting .NET framework is written in C#; therefore, its compiler can be considered the most tested and optimized compiler of those shipping with the CLR. The C# language borrows power from C++, but with modernization and the addition of type safety--making C# the number one choice for enterprise solutions.
If you are new to programming, this book is not for you. This book is intended to get programmers off and running with C#, based on knowledge that they already have. Presenting C# is targeted at programmers who already have programming experience in, for example, C or C++, Visual Basic, Java, or another language.
The transition to C# is easiest when you have a background in C++; however, if you are fluent in a different language, this book will bring you up to date, too. The book is more fun if you have a little knowledge of COM programming, but COM programming is in no way mandatory.
How This Book Is Organized
The book is organized into twelve chapters. Here is a quick rundown on what is presented in each chapter:
What You Will Need to Use This Book
From the book's point of view, all you need is the .NET Software Development Kit (SDK). Although all you need at a minimum are the Common Language Runtime (CLR) and the C# compiler, having a machine loaded with the documentation and all the SDK's tools (including its debugger) is definitely a good idea when exploring the capabilities of this exciting new technology.
This book does not require you to have any of the Visual Studio 7 tools installed on your machine. My only recommendation is that you should have a decent programmer's editor that supports line numbering for editing C# source files.
What would you expect when you receive an email from an executive editor, mentioning that he wants to talk with you about an exciting book project? I didn't quite expect this book when Chris Webb called me. Chris's offer was way too exciting to turn downwriting a book about a new programming language.
Thanks to both Chris Webb and Brad Jones (the associate publisher) for putting their trust in me and my tight writing schedule. Both of themas well as the development editor, Kevin Howardhad to put up with my changes to the table of contents as the book progressed. You just can't kill old habits.
Special thanks to Christian Koller for reviewing my chapters and telling me when I once again left out details that non-C++ programmers would need for better understanding. Although I don't know everyone who was involved in this book project at Sams Publishing, I thank them all for bringing it to the shelves--especially within this tight schedule!
Finally, and of course most importantly, I want to thank my family for their continual support throughout all my book projects.
About the Author
Christoph Wille, MCSE, MCSD, CNA, and MCP-IT, works as a network consultant and programmer, and specializes in Windows DNA. He is recognized by Microsoft as a Most Valuable Professional (MVP) for Active Server Pages, and was one of only a handful of developers working with Microsoft on early versions of the C# language.
Christoph has authored or contributed to several books, including Sams Teach Yourself ADO 2.5 in 21 Days, Sams Teach Yourself Active Server Pages in 24 Hours, MCSE Training Guide: SQL Server 7 Administration, and Sams Teach Yourself MCSE TCP/IP in 14 Days.