100% found this document useful (1 vote)
18 views

A programmer s introduction to C 2 0 3rd Edition Eric Gunnerson - Read the ebook online or download it to own the full content

introduction

Uploaded by

rundhzenatu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
18 views

A programmer s introduction to C 2 0 3rd Edition Eric Gunnerson - Read the ebook online or download it to own the full content

introduction

Uploaded by

rundhzenatu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 47

Visit ebookfinal.

com to download the full version and


explore more ebooks or textbooks

A programmer s introduction to C 2 0 3rd Edition


Eric Gunnerson

_____ Click the link below to download _____


https://ebookfinal.com/download/a-programmer-s-introduction-
to-c-2-0-3rd-edition-eric-gunnerson/

Explore and download more ebooks or textbook at ebookfinal.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

A programmer s introduction to C 1st Edition Harvey M.


Deitel

https://ebookfinal.com/download/a-programmer-s-introduction-to-c-1st-
edition-harvey-m-deitel/

Exploring C The programmer s introduction to C 1st Edition


Ray Lischner

https://ebookfinal.com/download/exploring-c-the-programmer-s-
introduction-to-c-1st-edition-ray-lischner/

Professional Python Frameworks Web 2 0 Programming with


Django and Turbogears Programmer to Programmer 1st Edition
Moore
https://ebookfinal.com/download/professional-python-frameworks-
web-2-0-programming-with-django-and-turbogears-programmer-to-
programmer-1st-edition-moore/

Professional Python Frameworks Web 2 0 Programming with


Django and Turbogears Programmer to Programmer 1st Edition
Dana Moore
https://ebookfinal.com/download/professional-python-frameworks-
web-2-0-programming-with-django-and-turbogears-programmer-to-
programmer-1st-edition-dana-moore/
Pro C 2005 and the NET 2 0 Platform 3rd Edition Andrew
Troelsen

https://ebookfinal.com/download/pro-c-2005-and-the-
net-2-0-platform-3rd-edition-andrew-troelsen/

Beginning Python Programmer to Programmer 1st Edition


Peter C. Norton

https://ebookfinal.com/download/beginning-python-programmer-to-
programmer-1st-edition-peter-c-norton/

Learning C 3 0 3rd Edition Jesse Liberty

https://ebookfinal.com/download/learning-c-3-0-3rd-edition-jesse-
liberty/

ASP NET MVC 1 0 Test Driven Development Problem Design


Solution Wrox Programmer to Programmer 1st Edition Emad
Ibrahim
https://ebookfinal.com/download/asp-net-mvc-1-0-test-driven-
development-problem-design-solution-wrox-programmer-to-programmer-1st-
edition-emad-ibrahim/

Silverlight 3 Programmer s Reference Wrox Programmer to


Programmer 1st Edition J. Ambrose Little

https://ebookfinal.com/download/silverlight-3-programmer-s-reference-
wrox-programmer-to-programmer-1st-edition-j-ambrose-little/
A programmer s introduction to C 2 0 3rd Edition Eric
Gunnerson Digital Instant Download
Author(s): Eric Gunnerson, Nick Wienholt
ISBN(s): 9781590595015, 1590595017
Edition: 3
File Details: PDF, 2.94 MB
Year: 2005
Language: english
A Programmer’s Introduction
to C# 2.0
Third Edition
ERIC GUNNERSON AND NICK WIENHOLT
A Programmer’s Introduction to C# 2.0, Third Edition
Copyright © 2005 by Eric Gunnerson and Nick Wienholt
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means,
electronic or mechanical, including photocopying, recording, or by any information storage or retrieval
system, without the prior written permission of the copyright owner and the publisher.
ISBN (pbk): 1-59059-501-7
Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1
Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence
of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark
owner, with no intention of infringement of the trademark.
Lead Editor: Jon Hassell
Technical Reviewer: Gavin Smyth
Editorial Board: Steve Anglin, Dan Appleman, Ewan Buckingham, Gary Cornell, Tony Davis, Jason Gilmore,
Jonathan Hassell, Chris Mills, Dominic Shakeshaft, Jim Sumser
Assistant Publisher: Grace Wong
Project Manager: Kylie Johnston
Copy Edit Manager: Nicole LeClerc
Copy Editor: Kim Wimpsett
Production Manager: Kari Brooks-Copony
Compositors: Susan Glinert and Wordstop Technologies (P) Limited
Proofreader: Elizabeth Berry
Indexer: Broccoli Information Management
Artist: April Milne
Cover Designer: Kurt Krames
Interior Designer: Van Winkle Design Group
Manufacturing Manager: Tom Debolski
Distributed to the book trade in the United States by Springer-Verlag New York, Inc., 233 Spring Street,
6th Floor, New York, NY 10013, and outside the United States by Springer-Verlag GmbH & Co. KG,
Tiergartenstr. 17, 69112 Heidelberg, Germany.
In the United States: phone 1-800-SPRINGER, fax 201-348-4505, e-mail [email protected],
or visit http://www.springeronline.com. Outside the United States: fax +49 6221 345229,
e-mail [email protected], or visit http://www.springeronline.com.
For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219, Berkeley, CA
94710. Phone 510-549-5930, fax 510-549-5939, e-mail [email protected], or visit http://www.apress.com.
The information in this book is distributed on an “as is” basis, without warranty. Although every precaution
has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to
any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly
by the information contained in this work.
The source code for this book is available to readers at http://www.apress.com in the Downloads section.
To Tony Jongejan, for introducing me to programming and being ahead of his time.
—Eric Gunnerson
Contents at a Glance

Foreword to the Third Edition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii


Foreword to the First Two Editions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv
About the Authors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxvii
About the Technical Reviewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxix
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxi
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxiii

CHAPTER 1 Object-Oriented Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1


CHAPTER 2 The .NET Runtime Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
CHAPTER 3 C# Quick Start and C# Development . . . . . . . . . . . . . . . . . . . . . . . . . . 11
CHAPTER 4 Exception Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
CHAPTER 5 Classes 101 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
CHAPTER 6 Base Classes and Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
CHAPTER 7 Member Accessibility and Overloading . . . . . . . . . . . . . . . . . . . . . . . . 53
CHAPTER 8 Other Class Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
CHAPTER 9 Structs (Value Types) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
CHAPTER 10 Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
CHAPTER 11 Versioning and Aliases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
CHAPTER 12 Statements and Flow of Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
CHAPTER 13 Variable Scoping and Definite Assignment . . . . . . . . . . . . . . . . . . . 113
CHAPTER 14 Operators and Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
CHAPTER 15 Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
CHAPTER 16 Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
CHAPTER 17 Generics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
CHAPTER 18 Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
CHAPTER 19 Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
CHAPTER 20 Indexers, Enumerators, and Iterators . . . . . . . . . . . . . . . . . . . . . . . . 179
CHAPTER 21 Enumerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
v
vi ■C O N T E N T S A T A G L A N C E

CHAPTER 22 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207


CHAPTER 23 Delegates and Anonymous Methods . . . . . . . . . . . . . . . . . . . . . . . . . 217
CHAPTER 24 Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
CHAPTER 25 User-Defined Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
CHAPTER 26 Operator Overloading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
CHAPTER 27 Nullable Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
CHAPTER 28 Other Language Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
CHAPTER 29 Making Friends with the .NET Framework . . . . . . . . . . . . . . . . . . . . 283
CHAPTER 30 System.Array and the Collection Classes . . . . . . . . . . . . . . . . . . . . . 293
CHAPTER 31 Threading and Asynchronous Operations . . . . . . . . . . . . . . . . . . . . . 315
CHAPTER 32 Execution-Time Code Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
CHAPTER 33 Interop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
CHAPTER 34 .NET Framework Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
CHAPTER 35 Windows Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
CHAPTER 36 DiskDiff: More Sophistication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
CHAPTER 37 Practical DiskDiff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
CHAPTER 38 Deeper into C# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449
CHAPTER 39 Defensive Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473
CHAPTER 40 Tips for Real-World Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485
CHAPTER 41 The Command-Line Compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493
CHAPTER 42 C# Compared to Other Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . 497
CHAPTER 43 C# Resources and the Future . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515

INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517
Contents

Foreword to the Third Edition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii


Foreword to the First Two Editions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv
About the Authors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxvii
About the Technical Reviewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxix
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxi
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxiii

■CHAPTER 1 Object-Oriented Basics ....................................1

What’s an Object? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Containment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Polymorphism and Virtual Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Encapsulation and Visibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

■CHAPTER 2 The .NET Runtime Environment ...........................5

The Execution Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6


A Simpler Programming Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Safety and Security. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Powerful Tools Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Deployment, Packaging, and Support . . . . . . . . . . . . . . . . . . . . . . . . . 8
Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Assemblies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Language Interop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

■CHAPTER 3 C# Quick Start and C# Development . . . . . . . . . . . . . . . . . . . . . 11

Hello, Universe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Namespaces and using . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Namespaces and Assemblies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Basic Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Classes, Structs, and Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
vii
viii ■C O N T E N T S

Enums . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Delegates and Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Properties and Indexers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Developing in C# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
The Command-Line Compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Visual Studio .NET. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Other Tools of Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

■CHAPTER 4 Exception Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

What’s Wrong with Return Codes? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21


Trying and Catching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
The Exception Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Passing Exceptions on to the Caller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Caller Beware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Caller Confuse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Caller Inform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
User-Defined Exception Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Finally . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Efficiency and Overhead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Design Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

■CHAPTER 5 Classes 101 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

A Simple Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Member Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
ref and out Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Overloading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

■CHAPTER 6 Base Classes and Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

The Engineer Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39


Simple Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Arrays of Engineers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Virtual Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Abstract Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Sealed Classes and Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
■C O N T E N T S ix

■CHAPTER 7 Member Accessibility and Overloading . . . . . . . . . . . . . . . . . . 53

Class Accessibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Using internal on Members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
internal protected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
The Interaction of Class and Member Accessibility . . . . . . . . . . . . . . . . . . . 55
Method Overloading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Method Hiding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Better Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Variable-Length Parameter Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

■CHAPTER 8 Other Class Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

Nested Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Other Nesting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Creation, Initialization, Destruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Finalizers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Managing Nonmemory Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
IDisposable and the Using Statement. . . . . . . . . . . . . . . . . . . . . . . . . 68
IDisposable and Longer-Lived Objects . . . . . . . . . . . . . . . . . . . . . . . . 69
Static Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Static Member Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Static Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Read-Only Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Static Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Partial Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76

■CHAPTER 9 Structs (Value Types) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

A Point Struct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Boxing and Unboxing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Structs and Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Design Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Immutable Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
x ■C O N T E N T S

■CHAPTER 10 Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
A Simple Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Working with Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
The as Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Interfaces and Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Design Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Multiple Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Explicit Interface Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Implementation Hiding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Interfaces Based on Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Interfaces and Structs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

■CHAPTER 11 Versioning and Aliases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99


A Versioning Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Coding for Versioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
External Assembly Aliases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

■CHAPTER 12 Statements and Flow of Execution . . . . . . . . . . . . . . . . . . . . . . 105


Selection Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
if . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Iteration Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
while . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
do . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
foreach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Jump Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
break . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
continue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
goto . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
return . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Other Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
lock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
using. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
try-catch-finally. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
checked/unchecked . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
yield . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
■C O N T E N T S xi

■CHAPTER 13 Variable Scoping and Definite Assignment . . . . . . . . . . . . . 113


Definite Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Definite Assignment and Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116

■CHAPTER 14 Operators and Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119


Operator Precedence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Built-in Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
User-Defined Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Numeric Promotions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Arithmetic Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Unary Plus (+) over . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Unary Minus (-) over . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Bitwise Complement (~) over . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Addition (+) over . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Subtraction (-) over . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Multiplication (*) over . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Division (/) over . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Remainder (%) over . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Shift (<< and >>) over . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Increment and Decrement (++ and --) over . . . . . . . . . . . . . . . . . . 123
Relational and Logical Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Logical Negation (!) over . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Relational Operators over. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Logical Operators over . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Conditional Operator (?:) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Assignment Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Simple Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Compound Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Type Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
typeof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
is . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
as . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
checked and unchecked Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . 128

■CHAPTER 15 Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129


Numeric Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Conversions and Member Lookup . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Explicit Numeric Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Checked Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
xii ■C O N T E N T S

Conversions of Classes (Reference Types) . . . . . . . . . . . . . . . . . . . . . . . 133


To the Base Class of an Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
To an Interface the Object Implements . . . . . . . . . . . . . . . . . . . . . . 135
To an Interface the Object Might Implement . . . . . . . . . . . . . . . . . . 135
From One Interface Type to Another. . . . . . . . . . . . . . . . . . . . . . . . . 137
Conversions of Structs (Value Types) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137

■CHAPTER 16 Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139


Array Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Multidimensional and Jagged Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Multidimensional Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Jagged Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Arrays of Reference Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Array Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
The System.Array Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Sorting and Searching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Reverse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

■CHAPTER 17 Generics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145


An Overview of Generics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
Generic Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
Inheritance, Overriding, and Overloading . . . . . . . . . . . . . . . . . . . . . . . . . 151
Generic Interfaces, Delegates, and Events . . . . . . . . . . . . . . . . . . . . . . . 152
Conclusion and Design Guidance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155

■CHAPTER 18 Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157


Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
String Encodings and Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
Converting Objects to Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
An Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
StringBuilder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Regular Expression Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
More Complex Parsing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Secure String . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
■C O N T E N T S xiii

■CHAPTER 19 Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169


Accessors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
Properties and Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Use of Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Side Effects When Setting Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
Static Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Property Efficiency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Property Accessibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Virtual Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177

■CHAPTER 20 Indexers, Enumerators, and Iterators . . . . . . . . . . . . . . . . . . . 179


Indexing with an Integer Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Indexing with a String Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
Indexing with Multiple Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
Enumerators and foreach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Improving the Enumerator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Disposable Enumerators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
GetEnumerator() Returns IEnumerator . . . . . . . . . . . . . . . . . . . . . . . 191
GetEnumerator() Returns a Class That Implements
IDisposable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
GetEnumerator() Returns a Class That Doesn’t
Implement IDisposable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
Design Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
Iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
Complex Enumeration Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Generic Enumeration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Design Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198

■CHAPTER 21 Enumerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199


A Line-Style Enumeration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Enumeration Base Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Bit Flag Enums . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
The System.Enum Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
xiv ■C O N T E N T S

■CHAPTER 22 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207


Using Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
A Few More Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
An Attribute of Your Own . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
Attribute Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
Attribute Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Reflecting on Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213

■CHAPTER 23 Delegates and Anonymous Methods . . . . . . . . . . . . . . . . . . . . 217


Using Delegates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
Delegates to Instance Members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
Multicasting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
Delegates As Static Members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
Delegates As Static Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Anonymous Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225

■CHAPTER 24 Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229


Add and Remove Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
Custom Add and Remove . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233

■CHAPTER 25 User-Defined Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239


A Simple Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
Pre- and Post-Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Conversions Between Structs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
Classes and Pre- and Post-Conversions . . . . . . . . . . . . . . . . . . . . . . . . . 247
Design Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
Implicit Conversions Are Safe Conversions . . . . . . . . . . . . . . . . . . . 253
Define the Conversion in the More Complex Type . . . . . . . . . . . . . 254
One Conversion to and from a Hierarchy . . . . . . . . . . . . . . . . . . . . . 254
Add Conversions Only As Needed . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
Conversions That Operate in Other Languages . . . . . . . . . . . . . . . . 254
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
Conversion Lookup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
■C O N T E N T S xv

■CHAPTER 26 Operator Overloading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259


Unary Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
Binary Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
An Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
A Complex Number Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262

■CHAPTER 27 Nullable Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267


C# Language Nullable Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
SQL Language Differences and Similarities. . . . . . . . . . . . . . . . . . . 269
Design Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270

■CHAPTER 28 Other Language Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273


The Main Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
Returning an int Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
Command-Line Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
Multiple Main() Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
Preprocessing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
Preprocessing Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
Other Preprocessor Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
Inline Warning Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
Lexical Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282

■CHAPTER 29 Making Friends with the .NET Framework . . . . . . . . . . . . . . 283


Things All Objects Will Do . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
Equals() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Hashes and GetHashCode() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
Design Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
Value Type Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
Reference Type Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
xvi ■C O N T E N T S

■CHAPTER 30 System.Array and the Collection Classes . . . . . . . . . . . . . . . 293


Sorting and Searching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Implementing IComparable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
Using IComparer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
IComparer As a Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
Overloading Relational Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
Generic Comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
Advanced Use of Hashes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
Synchronized Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
Case-Insensitive Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
ICloneable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
Other Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
Design Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
Functions and Interfaces by Framework Class . . . . . . . . . . . . . . . . 313
Choosing Generics vs. Nongeneric Collections . . . . . . . . . . . . . . . . 314

■CHAPTER 31 Threading and Asynchronous Operations . . . . . . . . . . . . . . . 315


Data Protection and Synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
A Slightly Broken Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
Protection Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
Immutable Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
Mutexes and Semaphores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
Access Reordering and Volatile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
Using volatile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
Joining . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
Waiting with WaitHandle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
Asynchronous Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
A Simple Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
Return Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
Waiting for Completion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
Classes That Support Asynchronous Calls Directly . . . . . . . . . . . . . . . . . 340
Design Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340

■CHAPTER 32 Execution-Time Code Generation . . . . . . . . . . . . . . . . . . . . . . . 341


Loading Assemblies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
Making It Dynamic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
Custom Code Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344
■C O N T E N T S xvii

Polynomial Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344


A Custom C# Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
A Fast Custom C# Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
A CodeDOM Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354
A Reflection.Emit Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
Lightweight Code Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361

■CHAPTER 33 Interop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365


Using COM Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
Being Used by COM Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
Calling Native DLL Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
Pointers and Declarative Pinning . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
Structure Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
Calling a Function with a Structure Parameter . . . . . . . . . . . . . . . . 369
Fixed-Size Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
Hooking Up to a Windows Callback . . . . . . . . . . . . . . . . . . . . . . . . . 372
Design Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374

■CHAPTER 34 .NET Framework Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375


Numeric Formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
Standard Format Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
Custom Format Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
Numeric Parsing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
Date and Time Formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
Custom DateTime Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
Custom Object Formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
Numeric Parsing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
Using XML in C# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388
Input/Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388
Binary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
Text. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
Reading and Writing Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390
Traversing Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390
Starting Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392
Serialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
Custom Serialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
Reading Web Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
Accessing Environment Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400
xviii ■C O N T E N T S

■CHAPTER 35 Windows Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403


Creating Your Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
Using the Form Designer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406
Finding Directory Sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406
Calculating Sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
A Debugging Suggestion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
Displaying the Directory Tree and Sizes . . . . . . . . . . . . . . . . . . . . . . . . . . 410
Setting the Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
Tracking Your Progress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412

■CHAPTER 36 DiskDiff: More Sophistication . . . . . . . . . . . . . . . . . . . . . . . . . . . 417


Populating on a Thread . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
Interrupting a Thread . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
A Cancel Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420
Decorating the TreeView . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420
Expand-o-Matic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422
Populate on Demand . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
Sorting the Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
Saving and Restoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
Controlling Serialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
Finer Control of Serialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427

■CHAPTER 37 Practical DiskDiff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431


Comparing Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
File Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432
File and Directory Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434
Updating the User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435
A Bit of Refactoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436
Cleaning Up for the Parents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
Keyboard Accelerators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
Most Recently Used List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
Most Recently Used List: A Configuration File Alternative . . . . . . . 439
ToolTips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441
Increased Accuracy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441
Switching to Use Cluster Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443
Deploying DiskDiff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443
ClickOnce in Perspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447
■C O N T E N T S xix

■CHAPTER 38 Deeper into C# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449


C# Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449
Naming. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449
Encapsulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450
Guidelines for Library Authors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450
CLS Compliance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450
Class Naming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451
Unsafe Context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451
XML Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
Compiler Support Tags. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
XML Documentation Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458
XML Include Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
Garbage Collection in the .NET Runtime . . . . . . . . . . . . . . . . . . . . . . . . . 460
Allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
Mark and Compact . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
Generations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
Finalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462
Controlling GC Behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463
Deeper Reflection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465
Listing All the Types in an Assembly . . . . . . . . . . . . . . . . . . . . . . . . 465
Finding Members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466
Invoking Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467
Dealing with Generics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
Optimizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472

■CHAPTER 39 Defensive Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473


Conditional Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473
Debug and Trace Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474
Asserts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474
Debug and Trace Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475
Using Switches to Control Debug and Trace . . . . . . . . . . . . . . . . . . . . . . 477
BooleanSwitch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477
TraceSwitch. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478
User-Defined Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480
Capturing Process Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483
Discovering Diverse Content Through
Random Scribd Documents
"Well, Mary, is Master Fred in?" his face grew suddenly glad, and,
sitting up on the sofa, he turned his head eagerly towards the door.

Mary's reply was inaudible to him, as she said,—

"Oh, Miss Carter, I'm so glad you've come. Master Fred's all alone out
in the back parlor, and he's sad enough, poor boy!"

Then he heard Bess speak again: "Please take my cloak, Mary, it is so


wet; and ask him if I may go right in there."

"Oh, do come quick, Miss Bessie!" he called out. "I'm so glad you have
come." And as he heard the door open, and the light, quick steps advancing
towards him, he stood up and put out both hands to greet his guest, with no
trace of his old fretful look.

With a hasty glance Bess noted the helplessness that prevented his
meeting her at the door, but she only said, as she kissed him,—

"Well, Fred, I am so glad to have you back within reach once more."

"You have missed me, then?" asked the child anxiously, as she drew him
to the sofa and seated herself by his side.

"Missed you, you silly boy! What a question! Of course I have. 'We
boys,' as Rob says, have been longing for you to be back again. I have felt
quite lost without you."

"How is Rob,—and all the other boys?" inquired Fred, relieved that
Bess seemed so unconscious of his condition.

"Well, all of them. Rob is coming down as soon as you feel like seeing
him. I see more of him than I do of any of the others. Phil runs in once in a
while, but he is so busy all the time. Teddy was at the house one day last
week, the same dear, slangy boy as ever. But tell me, am I not crazy to
come down such a day?"

"It's a kind of crazy I like," said Fred. "You were awfully good to come,
and I've been alone here ever so long."
"So much the better," said Bess, mentally abusing the mother who could
leave her boy under such circumstances; "we can have a real good, old-
fashioned visit, and when you get tired of me, you may send me off."

Fred's hand moved about in search of hers, as he asked,—

"How did you know I'd come?"

"Rob told me last night."

"Did he tell you"—

Fred could go no farther. Bess pulled the appealing little face over
against her shoulder, and gently smoothed his hair, as she answered, using
all her self-control to speak quietly,—

"Yes, dear, he did. I can't tell you how sorry we all felt for our boy. That
doesn't make it any easier to bear, I know; but perhaps in time we can help
you a little."

For the first time since his learning the sad truth, the boy broke down.
He had listened to the words of the oculist without a tear, too much stunned
even to speak, and he had met his father and mother with perfect quiet. But
the few gentle, loving words had broken his firm resolve not to be a baby;
and the tears gathered fast and fell, as he sat with his head on Bessie's
shoulder, her arm about his quivering little body.

"Oh, don't tell the boys!" he sobbed at last. "Don't tell them I cried. I
didn't mean to; but it's all so dreadful, here in the dark."

The tears stood in the girl's eyes as she answered,—

"My dear little boy, we all know how terrible it must be; but I won't tell
the boys if you say so. Just cry it all out; you have tried to be too brave. Rob
almost cried for you last night."

The sobs came less often, but the look of sadness on the boyish face
made Bessie's heart ache for the child, but she said cheerfully,—
"Now, my son, I am going to take my old place as nurse to-day. You
aren't very strong yet, and I want you to lie down again here on the sofa,
and if you can spare a little of this lunch—I don't approve of candy between
meals, you know—I'll move the table away, pull up this low chair, and tell
you all the news."

Suiting the action to the word, Bess tucked the afghan round Fred's feet,
drew a willow chair up to the place of the despised table, and sat down
close to the child, who once more reached out for her hand.

For an hour she sat there chatting to the boy, telling him of the scrapes
his friends had been in, of the pranks they had played, until she began to see
traces of the old merry Fred, as the look of sorrow gave place to a smile,
and then to a hearty laugh, while she described Rob's recent attempts to
climb a picket fence too hastily, and his being caught by his shoe and hung
head downward, from which position he was ignominiously rescued by a
passing Irishman.

In the mean time, Bess was glad that her little friend could not see her
expression, as she sat looking at the worn, sad face, and the great vacant
eyes, that used to have such bright mischief dancing in them. But she forced
herself to talk on, as easily as she could, more than rewarded by the
pleasure in Fred's face, and his tight grip of her hand.

At length a step was heard on the stairs, and Mrs. Allen, daintily dressed
and looking provokingly fresh and unruffled, Bess thought, came into the
room.

"Why, Bessie, when did you come? How stupid of Mary not to tell me
you were here!"

"I told her I came to see Fred, and not to disturb you," said Bess, as Mrs.
Allen swept to the sofa and bent over her son.

"I am quite jealous of Fred, for you have hardly been here all the time
he was away," she said. "But he needs you now badly enough, poor boy!"
putting a delicately embroidered handkerchief to her eyes. "Isn't it hard to
see him in this condition?"
Again the burning flush rolled up to Fred's hair, and the hand that was
tightly clasping Bessie's grew suddenly cold. Bess gently kissed him before
she answered,—

"You ought to know of my sympathy for Fred, Mrs. Allen. No words


can express it. But I am glad to have him here again. We were having such a
good talk, just like old times."

With an air of relief, Mrs. Allen took the hint, and left them alone again.
When she was gone, the boy settled back on his pillow, saying gratefully,—

"It is awfully nice to have you here. Tell some more about the fellows."

So Bess talked on, racking her brains for any bright, funny bit of gossip
that could rouse the lad from his depression, and give him something to
think of during the many sad, lonely hours that she saw were in store for
him. But the dreamy chime of the cathedral clock on the mantel, as it struck
four, reminded her of her promise to see Rob after school, and she rose to
go, saying brightly,—

"Now, my boy, I have worn you all out with such a long visit, for a first
one. I must go now, for Rob is coming up after school, and I must be at
home in time to see him. I hope I sha'n't drown on the way," she added, as a
fresh gust of wind brought a flurry of rain against the windows.

"I wish you needn't go," said the child. "It has been so jolly to see you
again. You haven't been here but a few minutes."

"An hour and a half, exactly," answered Bess, "but I'm coming again
real soon."

In the early twilight of the stormy day, the room was growing dark. As
Bess stooped to say good-by to the boy, she was surprised to feel the hot
tears on his cheeks. Sitting down on the edge of the sofa, she drew his head
over into her lap, and stroked his face in silence, for she felt no words could
comfort the little lad.
"If you only needn't go," he said. "It all seems so much easier when you
are here. Miss Bessie, I can't stand it! What shall I do?"

"Fred, I know it is hard, so very hard. I wish I could stay with you
always, if you want me. But I will truly come again in a day or two. We are
all so sorry for you, and long to help you." Then she asked, "May Rob come
some day to see you? He is such a good little nurse."

Fred shook his head.

"Not yet," said he. "I'd rather not have the boys round just yet. But I
mustn't keep you. Good-by." And, getting up, he moved a few steps towards
the door.

"Don't be in too much of a hurry, my dear," said Bess. "I must ring for
Mary to bring my cloak. Don't try to come to the door, you will only tire
yourself for nothing." And, putting him back on the sofa with a gentle force,
she kissed him and was gone.

Later, when Bess, her parents, and Rob, who had been prevailed upon to
stay, sat at their dinner-table, the young lady, after silently pondering some
question in her own mind, suddenly announced with considerable energy,—

"I think Mrs. Allen is the most selfish woman I ever saw!"

Mrs. Carter, in her surprise at the outburst, dropped the biscuit that she
was feeding to Fuzz, under cover of the tablecloth; for it was the rule of the
family, agreed to by each, and broken by all, that Fuzz should not be fed at
meal-times. The biscuit was at once appropriated by the dog, who trotted
off to a corner with it in his mouth, and there proceeded to devour it, with
sundry growls at the shaggy collie who gazed with longing eyes on the
tempting morsel.

"Bess, my daughter," began Mrs. Carter, "don't be too severe. She may
not be very strong."

"Strong, mother! How much strength does it take to entertain one's son
who is ill? She'd better give up a few dinners and theatres. The idea of her
leaving Fred alone all the afternoon. Rob, the next time you come up here,
when you are tired and cross and headache-y, I am going to take a nap, so
there!"

CHAPTER III.

THE BEGINNING OF THE FIGHT.

True to her promise, Bess did go often to see her boy. For several weeks
it was her habit to spend a part of every afternoon with him; and the lad's
evident pleasure at her coming made her feel richly rewarded for the time
she gave up to him. He at once recognized her step in the hall, and she
always found him sitting up on the sofa, eagerly waiting for her to come to
him.

Mrs. Allen rarely appeared, and the two had the room to themselves,
while Bess either read aloud, or talked to Fred as she sewed on some bit of
work she had brought with her. To her mother she confessed that after her
usual call her mind was a blank, for she tried so hard to think of some
bright, interesting conversation for the lonely, sad boy. Her patient was not
an easy one to manage, for though Fred rarely complained, during the long
hours he was alone he brooded over his trouble until it seemed even harder
than before, and the old days of school and games were like dreams of
another and a happier world. His father was at his office all day, and his
mother, absorbed in her social life, had little time to give to her son; and
both of them regarded the boy as well cared for if he were only supplied
with all sorts of dainties, and had the most comfortable sofa and chair given
up to him.

Sometimes Bess found the child so disconsolate that she knew not how
to comfort him; sometimes he was moody, and slow to respond to her
efforts to be entertaining, but before she left him, her womanly tact had
smoothed away the frown, and forced him to laugh in spite of himself. And
in the worst of his moods he was never cross to her, but always seemed
grateful to her for her coming.

"If you only needn't go home at all!" he said to her one day. "It's lots
more fun when you are here, Miss Bess. The rest of the time I just lie here
and think till I get cross, and everything seems awful."

"Why do you 'just lie here and think,' then?" asked Bess, feeling that
here was a chance to make a good suggestion. "You are strong enough now
to go to drive every pleasant day. Why don't you?"

"I don't know; I don't want to," said Fred, as the quick color came to his
cheeks, that were beginning to have a more healthy look.

Bess was expecting that reply, for several times before now she had
tried to coax the boy into going out. But he had been ill and by himself for
so long, and had dwelt so continually on himself, that he had become very
sensitive about his blindness, a state of mind not at all improved by his
mother's tactless attempts at consolation. With Bess he could and did talk
freely, but with no one else, and he shrank from meeting any one who
called, and obstinately refused to see his boy friends, although Bess urged
him to let them come.

It was such an unnatural life for the boy, who, save in the one respect,
was rapidly returning to his old strength. Once let him break over this
sensitive reserve, and persuade himself to go out and enjoy the boys, and
Bess was sure that his life would be easier to bear.

To-day they were in their usual place by the fire. Bess was sewing, and
Fred was by her side, playing with the long loops of ribbon that hung from
her belt. Suddenly the girl rose and went to the window.

"Where are you going, Miss Bess?"

"I am going to run away from you, you obstinate boy. I want to see your
mother a minute. I'll come back, so don't you worry."
For Bess had determined on a bold stroke. The air inside the room was
warm and heavy with the fragrance of roses. Outside, all was bright and
bracing, for an inch or two of snow had fallen the night before, and the air
after the storm was clear and sweet. Across the street, two rosy-cheeked
urchins were having a grand snowball fight, and Bess only wished that she
and Fred could join them. She heard their shouts of laughter as a
particularly large snowball struck one of them, just as he was stooping for
more ammunition, and half the snow was scattered down his neck.

The next moment she had tapped at Mrs. Allen's door.

"Come in," said a languid voice, and in she went.

Mrs. Allen, in a light wrapper, lay on a sofa, while Mary was kneeling
by her side, industriously polishing the nails of her mistress.

"Mrs. Allen," said Bess abruptly, "may Fred and I have the coupé this
afternoon?"

"Does he want to go out for a drive at last?" asked his mother.

"No, he doesn't," replied Bess, "but I want to have him go, and I think
that if the carriage were all at the door, I could get him started. May I try?"

"Of course you can have the carriage, Bessie; (a little more on the
thumb, Mary) but why do you tease him, if he doesn't want to go? It won't
be any pleasure to him, and if he is more comfortable at home, why not let
him do as he likes?"

Bess dropped into a chair, and wrinkled her brows with exasperation.

"Why, don't you see, Mrs. Allen," she said, "the boy can't spend all his
life in that one room. He must go out of it sometime, and the longer he
waits the harder it will be for him. He ought to have been out weeks ago,
for he needs the fresh air, and he is getting just blue and morbid from
staying alone in the house all this time."
"Perhaps you are right (now the other hand, Mary). Of course you can
have James and the coupé, if you will order what you want. It will be
pleasanter for you, if not for Fred."

Bess felt her color come. She had not expected much from Mrs. Allen,
but this was too unkind,—to think that she was speaking two words for
herself and one for Fred! But Mrs. Allen was not fine enough to see how
her remark had cut, and Bess resolved to bear anything for the sake of her
boy; so she thanked his mother, a little coldly, perhaps, and then departed to
the kitchen, where she asked the coachman to bring the coupé to the door as
soon as he could, and requested the plump, ruddy cook, the family tyrant, to
get her Fred's coat and hat.

The good woman's face brightened perceptibly.

"An' is it goin' out he is? Bless the poor dear b'y; it's a long, long time
since he's had a hat on his head, and it's I as am glad to be gettin' it for you.
The air'll do him good, sure!"

Bess thanked the woman warmly as she took the wraps, for she noted
the difference in tone between the mother and the servant. Then she
returned to the parlor, where she dropped Fred's heavy coat and hat on a
chair, and went back to her old place by the fire.

"Seems to me you've been gone a good while," said the boy, as Bess sat
down on the sofa, and pulled his head, pillow and all, into her lap.

"I just wanted you to find out how charming my society is," she said
playfully, as she twisted his scalp-lock till it stood wildly erect.

"As if I didn't know anyway," responded Fred. "But what are you trying
to do to me?"

"Only beautifying you a little, sonny," said Bess, with one eye on the
window.

In a few moments she saw the carriage drive up to the door and stop.
She took the boy's hand firmly in her own, and said very quietly, from her
position of vantage,—

"Now, Fred, I have a favor to ask of you; it is something I want so very


much. Will you do it for me?"

"What is it?" asked the boy suspiciously.

"The coupé is all ready at the door, and I have brought in your coat and
hat. It is such a lovely day, I want you to come for a drive. Will you?"

"No, I won't," said the boy, turning his face away from her, and putting
his hand over his eyes.

"Listen, Fred," said Bess firmly; "I know just how you feel about this,
but is it quite right to give up to it? You have all your life before you, and
you can't lie on this sofa all your days. I have waited until you were
stronger, hoping you would feel like starting out; but the longer you are
here, the harder it will be! You will have to go sometime; why not to-day?"

"What's the use?" asked the boy sadly. "I sha'n't get any good of going. I
don't see why I'm not as well off here."

"It is a beautiful day after the snow, and the air is so fresh it will do you
good. You need some kind of a change. We will only go a little way, if you
say so. Come, Fred." And she waited.

She saw the boy shut his lips tight together, and two great tears rolled
out from under his hand. Then he said slowly,—

"I'll go, Miss Bessie."

"That's my dear, brave boy," said Bess, as she went to get their wraps.
She helped Fred into his hat and coat, quickly put on her own, and, drawing
his hand through her arm, led him to the door, talking easily all the time to
keep up the lad's courage.

Just as they came out of the house, Rob and Phil chanced to be passing.
Turning, as they heard the door open and close, they saw Bess helping their
friend to the carriage, waved their hats to her, and started to run back to
greet Fred. But Bess motioned to them to keep away, for she felt that her
charge was in no condition now to meet these strong, lively friends, just as
he was forced to realize anew his own helplessness. So the lads stood sadly
by, looking on while their unconscious friend slowly and awkwardly
climbed into the carriage. Bess followed, and, with a wave of her hand to
the watching boys, they drove away.

"That isn't much like Fred," said Phil, as he turned away with a serious
look on his jolly, freckled face. "Just think of the way he used to skate, and
play baseball and hare and hounds! It must be awful for him. But isn't it
funny he won't let us go to see him?"

"I don't know," replied Rob, meditatively patting a snowball into shape;
"I guess if I were like what Fred is, I shouldn't want the boys round, for
'twould just make me think all the time of the things I couldn't do. Cousin
Bess is awfully good to him; she's down here ever so much."

"I know it. Wonder if anything happened to me, she'd take me up," said
Phil, half enviously. "I just wish she was my cousin, Bob. Why, she's as
good as a boy, any day!"

In the mean-time, Fred's first care had been to draw down the curtains
on his side of the carriage, and then he shrank into the corner, answering as
briefly as possible to Bessie's careful suggestions for his comfort. But her
endless good-humor and fun were never to be long resisted, and he was
soon talking away as rapidly as ever, while the change and the motion and
the cool crisp air brought a glow to his cheeks that made him look like the
Fred of former days. After driving for nearly an hour, the carriage stopped.

"Are we home?" asked Fred, starting to rise.

"At mine, not yours. Mother was going out to tea, to-night, and you
have been such a good boy that, as a reward of merit, I am going back to
dinner with you; only I must stop and tell mother, and send word to Rob to
come down after me. Shall I come?" And Bess paused with a smile, waiting
to see the effect of her new plan.
"Oh, yes, do come!" said Fred eagerly. "And tell Bob not to come for
you too early."

"What fun we'll have," he continued, when Bess had come back from
the house and they were driving away, regardless of the wails of Fuzz, who
surveyed them from a front window. "We'll play—how I wish I ever could
play games any more!" And his face grew dark again.

"You can, ever so many. But will you go home, or shall we drive a little
longer?"

"Home, please: that is, if you are willing, Miss Bessie."

"Fred, do you think me a dragon?" asked Bess, soberly. "Now tell me


truly, are you sorry you came out to-day? Even if you are a little tired, won't
the old sofa feel all the better for the change?" And while she waited for his
reply, she looked with pleasure at the clear, bright color that the wind had
brought into his cheeks.

"No, I don't know as I'm sorry, as long as you came too. But it's no fun
driving alone, and mother's too busy to go with me."

There was a pause, and then he suddenly asked,—

"Miss Bess, what makes you so good to me?"

"Good, to have a pleasant drive with my boy. I didn't suppose that


showed any great virtue. But," added Bess more seriously, "I want to teach
my boy to make the very best of his life. You have one hard, hard sorrow to
bear, dear; but you have ever so many pleasant things to enjoy, if you only
think of it: your home," here Bessie caught her breath, as a vision of Mrs.
Allen crossed her mind, then went on calmly, "all your friends, who care so
much for you; and then there are so many things you can do, as you get a
little more used to yourself. But this is enough sermon now, for here you are
at home. Just take my arm." And she led the boy into the house and up to
the fire.
Mr. and Mrs. Allen dined out that night, and Fred and Bess had the
house to themselves. Fred was so roused by the little change, and Bess so
pleased at her own success, that their dinner was a merry one. Fred insisted
that it should be served on a small table by their favorite fire, instead of in
the imposing dining-room, and Mary, rejoiced at anything that could bring
Master Fred out of his languid indifference, was only too glad to make the
change, however much work it might involve for herself.

The boy was in fine spirits, in his delight at having Bess stay to dinner,
all to himself, and the two told stories and asked conundrums till the room
fairly rang with their mirth. At dinner, Bess sent Mary away and waited on
the boy herself, giving him the needed help in such a matter-of-course
fashion that he forgot to feel sensitive about it until long after his guest had
gone.

After dinner, when the table was cleared away, and Fred's sofa moved
again to the fire, they both settled themselves on it for a quiet chat. The fire
shone out on a pretty picture. Bess, in her dark red gown, sat leaning
luxuriously against the dull blue cushions of the oak sofa, while Fred was
close by her side, with his hand through her arm, his head on her shoulder,
listening with a laughing face to his friend's account of some college frolics.
There was no light in the room but the steady glow from the grate, that
plainly showed their faces, but for the moment kindly hid the sad, blank
look in Fred's once beautiful eyes, and only gave them a dreamy, thoughtful
expression, as from time to time he turned his face up to Bess.

In the midst of their conversation, the bell rang, and the next moment
Mary, privately instructed by Bess, without word of warning ushered Rob
into the room. For a minute he stood, hesitating whether to speak to Fred or
not, but Bess quickly came to the rescue.

"Why, Rob, here so soon? Come up to the fire; there's ever so much
room here on the sofa."

And Fred's voice added,—

"Hullo, Bob!" as he hospitably made room for his guest.


There was another pause as Rob seated himself, for neither boy knew
just what to say. Fred had straightened himself up, and was twirling his
thumbs, while Rob crossed his feet and uncrossed them again, as he
methodically folded up his soft felt hat into a neat bundle.

As both boys declined to break the silence, Bess again took the lead.

"Is it cold to-night?" she asked Rob.

"Yes it's freezing fast, and 'twill be fine skating to-morrow. All us boys
are planning to go"—And Rob came to a sudden halt, as the idea dawned
on him that such subjects were not interesting to Fred, who asked abruptly,

"How's Phil?"

"He's well," replied Rob laconically, determined to make no mistake this


time.

"What's Bert Walsh doing with himself?"

"Football, of course." And both the boys laughed, for Bert's chronic
devotion to the game was the joke of all his friends.

But the next moment Bess felt Fred's head come over against her
shoulder. Rob watched him pityingly, not daring to speak his sympathy,
though he read his friend's thought.

"We've been reading 'Story of a Bad Boy,' this afternoon," said Bess,
trying once more to start the boys. Rob caught eagerly at the bait.

"Isn't it fine! That Fourth of July scrape just suits me."

And the boys were all animated as they discussed the details of the
story. Bess sat and watched them, occasionally putting in a word or two,
and soon all constraint had vanished, as the talk ran on from subject to
subject, and the long year of separation was a thing of the past.
Rob, mindful of what Bess had told him about Fred's sensitive reserve,
tried to seem perfectly unconscious of the change in his boy friend, but he
looked anxious and troubled, between his sympathy for Fred, and his desire
to say just the right thing. But when Bess rose to go, and Fred was slowly
following her to the door, Rob could stand it no longer,

"Say, Fred, I'm awfully sorry for you!" he blurted out.

Contrary to his expectations, the simple, boyish pity went right to Fred's
heart, and did it a world of good, but he only said,—

"It isn't much fun, Bob, I tell you. But won't you come down again some
day? I wish you would."

And Bess went home, well pleased with her day's work.

CHAPTER IV.

THE OTHER BOYS.

Bess was in her element.

"Cousin Bess," Rob had said that morning, "may some of us boys come
up to-night, or will we be in the way?"

"Not a bit of it!" replied Bess heartily; "I wish you would. Who are
coming?"

"Oh, just the regular crowd, Ted and Phil and Bert and Sam. The boys
wanted me to ask if we might, for fear you'd be out, or busy, or something."

That afternoon the first flakes of a snowstorm were falling, as Bess


started to make her usual pilgrimage to Fred, and by evening it lay over all
things soft and white.

"I am afraid your boys won't come," said Mrs. Carter, as they sat
lingering over their dinner. "It is too bad, when you are all ready for your
candy-pull."

"Don't you worry," predicted Bess, as she slyly dropped a morsel in


front of the nose of Fuzz, who for once lay asleep. "It will take more than
this snow to keep those boys away, unless Teddy has one of his colds and
can't come. I wish Fred could have been here."

"Why didn't you have him?" asked her mother.

"Have him!" echoed Bess. "It is easy to say 'have him,' but except for
half a dozen drives, he has refused to go out at all; and he won't see any of
the boys but Rob. Poor Rob tries to be very devoted, but I dimly suspect
Fred is occasionally rather cross."

"Who could blame him?" said Mrs. Carter.

"Rob takes it very meekly," Bess went on, as she slowly peeled an
orange. "Fred never shows that side to me, but I think it is there. But it is
really scandalous the way Mrs. Allen goes on. Fred is left to himself the
whole time, just when he needs so much help physically, mentally, and
morally."

"I wish you could have him all the time, Bess," said her mother. "You
are good for him, and he enjoys you."

"Let's adopt him, mother! He's splendid material to work on, and I
would take him in a minute if I could. Think of me with an adopted son!"
And Bess drew herself up with an air of majesty as she began to devour her
orange. Suddenly she laughed.

"I was so amused the other day, Saturday it was, when I went down to
Fred's in the afternoon. I was later than usual, and Rob happened to be there
ahead of me. You know I always go right in without stopping to ring, and
that day, as I went, I heard loud voices in the back parlor. I went in there,
and found that the boys had evidently been having a quarrel, for Fred had
turned his back to Rob, and was decidedly red in the face; while Rob sat
there, the picture of discomfort, his face pale, but his eyes fairly snapping.
He departed as soon as I went in, and neither boy would tell me what was
the trouble. Fred said he didn't feel well, and didn't want to see Rob,
anyway. I offered to go away too, but he wouldn't allow that."

"What did Rob say for himself?" asked Mrs. Carter.

"He said he supposed Fred was angry at something he had said in fun.
He was quite distressed over it, and offered to apologize, but I advised him
to just wait a few days till Fred recovered from his tempers."

"Much the best way," assented Mrs. Carter. "Fred mustn't grow
tyrannical. Here come the boys."

It was a needless remark, for at that moment there was heard a sudden
chattering of young voices, the sound of ten feet leaping up the steps, and
the laughter and stamping as the boys shook off the snow. Fuzz darted to
the door, barking madly, while an echo from without took up his voice and
multiplied it fivefold. Bess picked up the wriggling little creature, who was
carried off by Mrs. Carter; then she admitted her young guests, who came in
all talking at once.

"Such a deep snow!"

"Five or six inches, at least!"

"I tell you, that fire looks dandy!"

"Phil fell down just below Bob's gate."

"Good evening, Miss Bessie. So jolly of you to let us come!"

"I am ever so glad to have you care to come, boys. But come right in to
the fire and dry those wet feet. Phil, I am glad to see you wore rubber
boots."
"They're all full of snow where I fell down," answered Phil, as he
struggled to pull them off. "Here, Bob, help a fellow, will you?"

And the boots came off with a jerk, while a shower of half-melted snow
proved the truth of his statement.

As the lads drew their chairs to the fire and prepared to toast their toes,
a moment must be given up to glancing at them, as they sit recounting to
their hostess their varied experiences in the storm.

At her left hand sat Phil Cameron, a short, slight, delicate-looking boy
of thirteen, whose gray eyes, large mouth, pug nose, and freckled face
laughed from morning till night. Everybody liked Phil, and Phil liked
everybody in return. His invariable good temper, and a certain headlong
fashion he had of going into the interest of the moment, made him a favorite
with the boys; while his elders admired him for his charming manners and
his wonderful soprano voice, for he and Rob had the best voices in the little
village choir. Though not overwhelmed with too much conscience, Phil was
a thoroughly good boy, and one that his teachers and older friends petted
without knowing exactly why they did so.

Beyond him sat his great friend and boon companion in all their athletic
games, Bert Walsh, the doctor's son, a lad whose poet's face, with its great,
liquid brown eyes, and whose slow, deliberate speech, gave no indication of
the force of character that lay below. Like Phil, he was fond of all out-of-
door sports, but, unlike him, he was fond of books as well. A strong
character, emphatic in its likes and dislikes, Bert's finest trait was his high
sense of honor, that was evident in his every act.

On the other side of Bess was the minister's son, Teddy Preston, the
oldest of eight children, a frank, healthy, happy boy, good and bad by turns,
but irresistible even in his naughtiness. Brought up in a home where books
and magazines were always at hand, though knees and toes might be a little
shabby, Ted had contrived to pick up a vast amount of information about the
world at large; and, added to that, he had the happy faculty of telling all he
knew. With an easy assurance he slipped along through life, never
embarrassed, and taking occasional well-merited snubs so good-naturedly
that his friends might have regretted giving them had they not known only
too well that they slid off from his mind like the fabled water from a duck's
back. A year younger than Phil, his yellow head towered far above him, and
he outgrew his coats and trousers in a manner entirely incompatible with
the relative sizes of the family circle to be clothed, and of the paternal
salary. But Ted never minded that. He carried off his shabby clothes as
easily as Bert did his perfectly fitting suits, and seemed in no way
concerned about the difference.

A year older than any of the other lads was Sam Boeminghausen, a
short, sturdy boy, a real German, blond, phlegmatic, and good-humored.
But his light blue eyes had a look of determination that suggested that the
day might come when Sam would be something or somebody. His father
had recently made a large fortune in Western cattle-ranching, and, as yet,
the family had not entirely adapted themselves to their new surroundings.
Sam's grammar was erratic, and his expensive garments had the look of
being made for another and a larger boy. But time would change that, and
under the careless speech and rough manners Bess could see the
possibilities of a glorious manhood.

On the floor at Bessie's feet sat our old friend Rob, poking the fire with
the tongs. The light fell on his fine, soft, brown hair, delicate skin, and
great, laughing dark eyes. Rob was the descendant of a long line of refined
ancestors, a real little gentleman, and he showed it from the perfect nails on
his small slim hands, brown as berries though they were, to the easy
position in which he now sat, with one foot curled under him. A gentle, shy
boy, affectionate and easily managed, he was an inveterate tease, and full of
a quiet fun that sparkled in his eyes and laughed in his dimples.

But while we have been gazing at the five lads, all so different from one
another, there was a sudden burst of applause as Bess rose, saying,—

"Now, boys, if you are all dry, I am going to invite my company out into
the kitchen. What do you say to making molasses candy and popcorn balls?
It is just the night for it."

"That's just dandy!" exclaimed Ted, springing up with a force that sent
his chair rolling back some inches.
"Ted, if you talk slang I sha'n't give you any to eat," said Bess
laughingly. "But come, boys." And she led the way into the large kitchen,
where her mother soon followed them with five large gingham aprons in
which she proceeded to envelop the lads, in spite of their derisive
comments.

"I am not going to have you spoil your clothes, children, for then your
mothers will scold us. Now, if I can't help you, Bess, I am going to stay
with Fuzz; and I leave you to do your worst."

"Don't go, Mrs. Carter," implored Ted, and the others echoed him; but
Mrs. Carter was not to be bribed, even by Phil's noble offer to let her do his
share of the work.

"I will eat your share of the candy, Phil, but I am going to stay with Mr.
Carter and Fuzz. I'll come and look at you by and by." And, drawing her
white shawl around her, she was gone.

Bess quickly divided her forces. Rob and Ted were set to shelling the
corn, while Phil and Bert scorched it and their faces at the same time. The
impressive duty of stirring the molasses she reserved for herself, assisted at
times by Sam.

For a short time all went well. But just as the bright new pan was nearly
full of the white kernels, and the molasses was beginning to show its
threads, a sudden determined bark was heard at the door, and the scratching
of two active little paws. Then followed the sound of Mrs. Carter's voice in
warning tones,—

"Fuzzy mustn't scratch the doors! No, no! Grandma 'pank."

An instant's pause was succeeded by a fresh onslaught on the door by


the small delinquent who scorned "grandma's" threats, having learned from
past experiences that patience would carry the day.

"It's Fuzz," said Rob. "Can't I let him in, Cousin Bess?"

"I wouldn't, Rob; he will be so in the way."


Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookfinal.com

You might also like