Preface

C# Essentials is a highly condensed introduction to the C# language and the .NET Framework. C# and the .NET initiative were both unveiled in July 2000 at the Microsoft Professional Developers Conference in Orlando, Florida, and shortly thereafter, the .NET Software Development Kit (SDK) was released on the Internet.

The information in this book is based on Release Candidate 1 (RC1) of the .NET SDK released by Microsoft in October 2001. We expect that version to be largely compatible with the final release, but Microsoft may make minor changes that affect this book. To stay current, be sure to check the online resources listed in Section P.3 as well as the O’Reilly web page for this book, http://www.oreilly.com/catalog/csharpess2 (see Section P.5).

Audience

While we have tried to make this book useful to anyone interested in learning about C#, our primary audience is developers already familiar with an object-oriented language such as C++, Smalltalk, Java, or Delphi. C# facilitates writing web applications and services, as well as traditional standalone and client/server-based applications. Experience in any of these areas will make the advantages of C# and the .NET Framework more immediately apparent but isn’t required.

About This Book

This book is divided into five chapters and six appendixes:

Chapter 1 orients you to C# and the .NET Framework.

Chapter 2 introduces the C# language and serves as a language reference.

Chapter 3 explains how to use C# and the .NET Framework.

Chapter 4 provides an overview of the key libraries in .NET—organized by function—and documents the most essential namespaces and types of each.

Chapter 5 is an overview of essential .NET tools that ship with the .NET Framework SDK, including the C# compiler and utilities for importing COM objects and exporting .NET objects.

The six appendixes provide additional information of interest to working programmers, including an alphabetical C# keyword reference, codes for regular expressions and string formats, and a cross reference of assembly and namespace mappings

This book assumes that you have access to the .NET Framework SDK. For additional details on language features and class libraries covered here, we recommend the Microsoft online .NET documentation.

C# Online

Since this book is a condensed introduction to C#, it cannot answer every question you might have about the language. There are many online resources that can help you get the most out of C#.

We recommend the following sites:

http://msdn.microsoft.com/net

The Microsoft .NET Developer Center is the official site for all things .NET, including the latest version of the .NET Framework SDK, which includes the C# compiler, as well as documentation, technical articles, sample code, pointers to discussion groups, and third-party resources.

http://msdn.microsoft.com/net/thirdparty/default.asp

A complete list of third-party resources of interest to C# and .NET Framework developers.

http://discuss.develop.com/dotnet.html

The DevelopMentor DOTNET discussion list. Possibly the best site for freewheeling independent discussion of the .NET languages and framework; participants often include key Microsoft engineers.

http://www.oreillynet.com/dotnet

The O’Reilly Network .NET DevCenter, which features original articles, news, and weblogs of interest to .NET programmers.

http://dotnet.oreilly.com

The O’Reilly .NET Center. Visit this page frequently for information on current and upcoming .NET books from O’Reilly. You’ll find sample chapters, articles, and other resources.

Two articles of interest include:

http://windows.oreilly.com/news/hejlsberg_0800.html

An interview with chief C# architect Anders Hejlsberg, by O’Reilly editor John Osborn.

http://www.genamics.com/developer/csharp_comparative.htm

A comparison of C# to C++ and Java, by coauthor Ben Albahari.

You can find Usenet discussions about .NET in the microsoft.public.dotnet.* family of newsgroups. In addition, the newsgroup microsoft.public.dotnet.languages.csharp specifically addresses C#. If your news server does not carry these groups, you can find them at news://msnews.microsoft.com.

Conventions Used in This Book

Throughout this book we use these typographic conventions:

Italic

Represents the names of system elements, such as directories and files, and Internet resources, such as URLs and web documents. Italics is also used for new terms when they are defined and, occasionally, for emphasis in body text.

Constant width

Indicates language constructs such as .NET and application-defined types, namespaces, and functions, as well as keywords, constants, and expressions that should be typed verbatim. Lines of code and code fragments also appear in constant width, as do classes, class members, and XML tags.

Constant width italic

Represents replaceable parameter names or user-provided elements in syntax.

We have included simple grammar specifications for many, but not all, of the language constructs presented in this book. Our intent is not to be comprehensive—for that level of detail you should consult the Microsoft C# Programmer’s Reference in the .NET SDK—but rather to provide you with a fast way to understand the grammar of a particular construct and its valid combinations. The XML occurrence operators (?,*, and +) are used to specify more precisely the number of times an element may occur in a particular construct.

x

Indicates x is to be used verbatim (constant width)

x

Indicates x is supplied by the programmer (constant width italic )

x?

Indicates x may occur zero-or-one times

x*

Indicates x may occur zero-or-more times, separated by commas

x+

Indicates x may occur one-or-more times, separated by commas

[... ]

Indicates a logical grouping of code elements, when not implicitly grouped using the verbatim terms {}, (), and []

[ x | y ]

Indicates only one of a choice of code elements may occur

Tip

This icon designates a note, which is an important aside to the nearby text.

Warning

This icon designates a warning relating to the nearby text.

We use the acronym “FCL” to refer to the .NET Framework Class Library. You may have heard this referred to as the Base Class Library in other works, including the first edition of this book.

How to Contact Us

Please address comments and questions concerning this book to the publisher:

O’Reilly & Associates, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
(800) 998-9938 (in the United States or Canada)
(707) 829-0515 (international or local)
(707) 829-0104 (fax)

We have a web page for this book, where we list errata, examples, or any additional information. You can access this page at:

http://www.oreilly.com/catalog/csharpess2

To comment or ask technical questions about this book, send email to:

For more information about our books, conferences, Resource Centers, and the O’Reilly Network, see our web site at:

http://www.oreilly.com

Acknowledgments

This book would not be possible without the contribution and support of many individuals, including friends, family, and the hard-working folks at O’Reilly & Associates, Inc.

All three of us wish to thank Brian Jepson for his sterling editorial work on the 2nd edition of this book, as well as Jeff Peil for his contributions to the sections of the book that deal with threads and interop. Many thanks as well to Scott Wiltamuth, Joe Nalewabu, Andrew McMullen, and Michael Perry, whose technical reviews have immeasurably improved our text.

Ben Albahari

First of all, I’d like to thank my family (Sonia, Miri, and Joseph Albahari) and friends (most of all Marcel Dinger and Lenny Geros) for still wanting to know me given that I’m practically epoxied to my computer. I’d also like to thank all the bands (can’t list them all but particularly Fiona Apple, Dream Theater, and Incubus during this writing period) for the CDs that clutter my desk, without which I would never have been motivated enough to stay up till 5:00 a.m. to simulate being in the same time zone as the great people in America I worked with when writing this book (John Osborn, Peter Drayton, and Brad Merrill). Finally I’d like to thank everyone who is enthusiastic about new technology, which ultimately is what drove me to write this book. I’d like to dedicate this book to my late father, Michael, to whom I am indebted for his foresight in introducing me to programming when I was a child.

Peter Drayton

Above all, I’d like to thank my wife, Julie DuBois, for her constant, loving support. Regardless of how engrossing the world of bits can be, you serve as a constant reminder of how much more wonderful the world of atoms really is. I’d like to thank my coauthors, Ben and Brad, for so graciously affording me the opportunity of participating in this project, and our editor, John Osborn, for keeping all three of us pointed in the same direction during the wild ride that resulted in this book. I’d also like to thank my friends and colleagues (most notably John Prout, Simon Fell, Simon Shortman, and Chris Torkildson) who serve as trusty sounding boards on technical and life issues. Finally, I’d like to thank my family back in South Africa, especially my father, Peter Drayton Sr., and my late mother, Irene Mary Rochford Drayton, for giving me a strong rudder to navigate through life.

Brad Merrill

I’d like to thank my son Haeley, my partner Jodi, my coparent Cyprienne, and my friends (Larry, Colleen, and Evan) for their patience and support during this process. I’d also like to thank Ben and Peter for their immense contributions and our editor John Osborn for keeping us sane.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset