Professional C#, 2nd Edition
K. Scott Allen
Wrox Press Ltd. (
2002 Wrox Press
All rights reserved. No part of this book may be reproduced, stored in a retrieval system or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embodied in critical articles or reviews.
The author and publisher have made every effort in the preparation of this book to ensure the accuracy of the information. However, the information contained in this book is sold without warranty, either express or implied . Neither the authors, Wrox Press, nor its dealers or distributors will be held liable for any damages caused or alleged to be caused either directly or indirectly by this book.
Latest Reprint: September 2002
Published by Wrox Press Ltd,
Arden House, 1102 Warwick Road, Acocks Green,
Birmingham, B27 6BH, UK
Printed in USA
Wrox has endeavored to provide trademark information about all the companies and products mentioned in this book by the appropriate use of capitals. However, Wrox cannot guarantee the accuracy of this information.
K. Scott Allen
Juan Ramon Ravirosa
About the Authors
Simon Robinson lives in Lancaster in the UK, where he shares a house with some students. He first encountered serious programming when he was doing his PhD in physics, modeling all sorts of weird things to do with superconductors and quantum mechanics. The experience of programming was nearly enough to put him off computers for life (though, oddly, he seems to have survived all the quantum mechanics), and he tried for a while being a sports massage therapist instead. He then realized how much money was in computers compared to sports massage, and therefore, rapidly got a job as a C++ programmer/researcher instead. Simon is clearly the charitable, deep, spiritual type, who understands the true meaning of life.
His programming work eventually lead him into writing, and he now makes a living mostly from writing great books for programmers. He is a great enthusiast for C#, which he firmly believes is set to revolutionize programming. His spare time is spent either at dance classes (he loves performing arts) or on his pet project writing a computer strategy game. With what little time is left, he is an honorary research associate at Lancaster University, where he does research in computational fluid dynamics with the environmental science department. You can visit Simon's web site at http://www.SimonRobinson.com .
Apart from the editors who've been great to work with, and who've worked incredibly hard to help bring this book out, I'd like to thank:
Joe Crump at Microsoft, for some very useful technical input and getting a number of queries answered
Morgan Skinner for some useful suggestions for Chapter 5
Jason Sickler, a student at MIT, and alias Darrius, President of the Chinese, for agreeing to have details of his negotiations with me used in one of the samples in Chapter 12
K. Scott Allen
Over the last 10 years Scott Allen has designed software for Windows, embedded hardware, web applications, and massive multiplayer online games .
Scott holds an MS degree in Computer Science and an MCSD certification. He lives in Hagerstown, Maryland, with his wife Vicky, and sons Alex and Christopher.
Ollie has been working with the Internet and the Microsoft platform since the early 90's. In 1999 he co-founded a business-to-business Internet company and until recently, was their Chief Technical Officer.
Prior to that, his various roles involved programming, technical authoring, network management, writing, leading development projects, and consulting. He has worked with Demon Internet, Microsoft, Saab, Tesco, Travelstore, and Vodafone. Ollie has a degree in computer science and is Microsoft certified.
When he's not working he spends his time devouring books on human potential, practicing Chinese internal martial arts, meditating, and juggling fire.
I want to say thank you to my friends and family for the support and love you've given me. Life throws the good and the bad at us all, and you have made the bad stuff much easier to get past.
Jay started developing software in the late 1980's, writing applications for the Pick operating system in Pick BASIC. Since then he has created applications using Paradox PAL and Object PAL, Delphi, Pascal, C/C++, Java, VBA, and Visual Basic. Currently, Jay is a Project Coordinator and Architect for a large insurance company based in Nashville TN. For the past five years he has been developing software for pen-based computers and, more recently, for ASP and server-based systems. When not sitting in front of a keyboard, Jay is busy restoring a house in Franklin TN, playing a round of golf whenever possible, and watching Disney movies with his wife and three year old son. Jay can be reached at firstname.lastname@example.org .
I would like to thank my wife Lydia and my son Samuel for being patient and understanding of all the late nights. They are my motivation and inspiration.
Zach Greenvoss is a Senior Consultant with Magenic Technologies, a Microsoft Gold Certified Solution Provider and industry leader in providing custom business solutions utilizing the latest Microsoft technologies. He specializes in middle- tier architecture and implementation, utilizing various technologies including COM+, MSMQ, BizTalk, XML, and the .NET Framework. Zach's hobbies include traveling, caving, and playing his new XBox. He can be reached at email@example.com .
I would like to thank my wife Amanda for being patient and understanding of all the long hours.
Burton Harvey builds software that elegantly fulfils users' needs. An MCSD with fifteen years' experience using Microsoft development tools, Burt is adept at a multitude of technologies including VB, COM, ASP, SQL, C#, C++, x86 assembler, UML, WML, and the Palm OS.
In 1998, Burt served as the founding editor of an online journal of scientific research, Scientia . His Master's thesis, " The Outlaw Method for Solving Multimodal Functions with Parallel Genetic Algorithms ", was presented at the International Conference on Evolutionary Computation, and Burt has spoken on C# at Wrox conferences in Las Vegas and Amsterdam.
As a consultant, Burt provides services to healthcare companies, music publishers, financial institutions, and sports organizations. As the CEO of Promethean Personal Software, he develops handheld applications that empower the individual ( http://www.propersonal.com ).
Burt currently resides in Nashville, Tennessee, and can be reached at firstname.lastname@example.org . This is his third book.
Christian Nagel works as a trainer and consultant for Global Knowledge, the largest independent information technology training provider. Christian started his computing career with PDP 11 and VAX/VMS platforms. Since then he has used a variety of languages and platforms, including Pascal, C, X-Windows, Motif, C++, Java, COM/ATL, COM+, and currently C# and .NET. With his profound knowledge of Microsoft technologies - he's certified as Microsoft Certified Trainer (MCT), Solution Developer (MCSD), and Systems Engineer (MCSE) - he enjoys teaching others programming and architecting distributed solutions. As founder of the .NET User Group Austria and as MSDN Regional Director he is speaker at European conferences (TechEd, VCDC), and is contacted by many developers for coaching, consulting, and teaching customized courses and boot camps. You will find Christian's web site at http://christian.nagel.net/.
I would like to thank the people at Wrox who got me started writing books, and Christian Seidler who supports my activities at Global Knowledge. Special thanks are also sent to the people at Microsoft, primarily to Alex Holy in Vienna for his organization of Visual Studio events and for his support of the .NET user community. Finally, and most importantly, I would like to thank my wife Elisabeth for her love and support.
I started my computing at a tender age on a ZX80 at school, where I was underwhelmed by some code my teacher had put together and decided I could do better in assembly language. After getting hooked on Z80 (much better than those paltry three registers in 6502 land!) I graduated through the school ZX81s to my own ZX Spectrum.
Since then I've used all sorts of languages and platforms, including VAX Macro Assembler (way cool!), Pascal, Modula2, Smalltalk, x86 assembly language, PowerBuilder, C/C++, Visual Basic, and currently C#. I've managed to stay in the same company for nearly 12 years, largely down to the diversity of the job and a good working environment.
In my spare time I'm a bit of a DIY nut, I spend lots of money on bicycles, and 'relax' by fighting weeds on my allotment.
I can be reached by e-mail at email@example.com .
Karli Watson is an in-house author for Wrox Press with a penchant for multicolored clothing. He started out with the intention of becoming a world famous nanotechnologist, so perhaps one day you might recognize his name as he receives a Nobel Prize. For now, though, Karli's computing interests include all things mobile, and upcoming technologies such as C#. He can often be found preaching about these technologies at conferences, as well as after hours in drinking establishments. Karli is also a snowboarding enthusiast, and wishes he had a cat.
Thanks go to the Wrox team, both for helping me get into writing, and then for dealing with the results when I started. Finally, and most importantly, thanks to my wife, Donna, for continuing to put up with me.
Steve has been involved with programming since being introduced to the TRS-80 Model I computer in 1980 during the 6th grade, and began programming for Microsoft Windows with the release of Visual Basic 3.0. He is currently the Director of Architecture and Technology for Zeris Interactive, where he develops distributed applications for Zeris' clients using the gamut of Microsoft DNA tools and technologies.
Steve is also a private pilot and flies his Zenair CH-701 kitplane whenever he gets a chance. He lives with his family in Wake Forest, NC, and can be reached at firstname.lastname@example.org .