Home > Store

.NET Framework Standard Library Annotated Reference, Volume 1: Base Class Library and Extended Numerics Library

Register your product to gain access to bonus material or receive a coupon.

.NET Framework Standard Library Annotated Reference, Volume 1: Base Class Library and Extended Numerics Library

Book

  • Sorry, this book is no longer in print.
Not for Sale

Description

  • Copyright 2004
  • Edition: 1st
  • Book
  • ISBN-10: 0-321-15489-4
  • ISBN-13: 978-0-321-15489-7

Edited by a Lead Program Manager on Microsoft's .NET Framework team, .NET Framework Standard Library Annotated Reference, Volume 1, is the definitive reference for the .NET Framework base class library. This book utilizes extensive annotations and code samples from the creators of the technology to move beyond the online documentation and provide .NET developers with a dictionary-style reference to the most-used parts of the Framework. This volume covers a subset of the ISO CLI Standards, including the Base Class Library and the Extended Numerics Library.

In the printed book you will find informative overviews of each namespace covered and an easy-to-follow alphabetic reference of types in the standard, including type-level descriptions, sample code with output, and annotations from the design team and standardization committee.

With the ECMA and ISO standards as its core, this book includes:

  • Annotations from key members of the Microsoft design team and the Standardization committee. Comments cover everything from design rationale and history to common problems and shortcomings.
  • An overview of each namespace, describing its functionality and the inheritance hierarchy of types it defines.
  • Type descriptions. Each type is covered in its own chapter, with a detailed description of how the type is to be used and a quick reference of the C# declaration syntax for all members defined on the type. Also noted: which members are only available in the Microsoft implementation of the .NET Framework, which are not available in the .NET Compact Framework, and which are only available in V1.1 of the .NET Framework.
  • Code samples. Types are illustrated by fully compilable code samples with output included.
  • Reference tabs and an exhaustive index, which allow readers to quickly and easily navigate the text.
  • Reusable source code for more than one thousand samples. All code has been tested with versions 1.0, 1.1, and the 2.0 technical preview of the .NET Framework, and, where appropriate, with the .NET Compact Framework.

Downloads

CD Contents

Download the CD Contents from the book.

Sample Content

Online Sample Chapter

The .NET Framework Standard Library: the System Namespace

Excerpts

Download the CD Excerpt file related to this title.

Downloadable Sample Chapter

Download the Sample Chapter related to this title.

Table of Contents

Foreword xiii
Preface xvii

Part I Namespace Overviews 1

System 3
System.Collections 11
System.Diagnostics 14
System.Globalization 15
System.IO 17
System.Security 21
System.Text 25
System.Threading 27

Part II Class Libraries 31

System.ApplicationException 33
System.ArgumentException 35
System.ArgumentNullException 37
System.ArgumentOutOfRangeException 40
System.ArithmeticException 42
System.Array 44
System.Collections.ArrayList 52
System.ArrayTypeMismatchException 57
System.Text.ASCIIEncoding 59
System.AsyncCallback Delegate 61
System.Attribute 63
System.AttributeTargets Enum 68
System.AttributeUsageAttribute 71
System.Boolean Structure 75
System.Byte Structure 77
System.Char Structure 81
System.CharEnumerator 85
System.CLSCompliantAttribute 88
System.Security.CodeAccessPermission 90
System.Security.Permissions.CodeAccessSecurityAttribute 94
System.Collections.Comparer 96
System.Diagnostics.ConditionalAttribute 97
System.Console 100
System.Convert 104
System.DateTime Structure 115
System.Globalization.DateTimeFormatInfo 121
System.Globalization.DateTimeStyles Enum 131
System.Decimal Structure 133
System.Text.Decoder 140
System.Delegate 142
System.Collections.DictionaryEntry Structure 146
System.IO.Directory 148
System.IO.DirectoryNotFoundException 151
System.DivideByZeroException 153
System.Double Structure 155
System.DuplicateWaitObjectException 160
System.Text.Encoder 163
System.Text.Encoding 164
System.IO.EndOfStreamException 170
System.Enum 172
System.Environment 177
System.Security.Permissions.EnvironmentPermission 180
System.Security.Permissions.EnvironmentPermissionAccess Enum 183
System.Security.Permissions.EnvironmentPermissionAttribute 185
System.EventArgs 187
System.EventHandler Delegate 190
System.Exception 192
System.ExecutionEngineException 198
System.IO.File 201
System.IO.FileAccess Enum 204
System.Security.Permissions.FileIOPermission 206
System.Security.Permissions.FileIOPermissionAccess Enum 211
System.Security.Permissions.FileIOPermissionAttribute 213
System.IO.FileLoadException 215
System.IO.FileMode Enum 218
System.IO.FileNotFoundException 220
System.IO.FileShare Enum 223
System.IO.FileStream 225
System.FlagsAttribute 231
System.FormatException 233
System.GC 235
System.Collections.Hashtable 239
System.IAsyncResult Interface 245
System.ICloneable Interface 248
System.Collections.ICollection Interface 251
System.IComparable Interface 254
System.Collections.IComparer Interface 258
System.Collections.IDictionary Interface 260
System.Collections.IDictionaryEnumerator Interface 262
System.IDisposable Interface 264
System.Collections.IEnumerable Interface 267
System.Collections.IEnumerator Interface 269
System.IFormatProvider Interface 271
System.IFormattable Interface 273
System.Collections.IHashCodeProvider Interface 283
System.Collections.IList Interface 286
System.IndexOutOfRangeException 292
System.Int16 Structure 294
System.Int32 Structure 297
System.Int64 Structure 301
System.Threading.Interlocked 304
System.InvalidCastException 307
System.InvalidOperationException 309
System.InvalidProgramException 311
System.IO.IOException 312
System.Security.IPermission Interface 314
System.MarshalByRefObject 317
System.Math 319
System.IO.MemoryStream 321
System.Threading.Monitor 325
System.NotFiniteNumberException 331
System.NotImplementedException 333
System.NotSupportedException 335
System.NullReferenceException 337
System.Globalization.NumberFormatInfo 339
System.Globalization.NumberStyles Enum 343
System.Object 347
System.ObjectDisposedException 350
System.ObsoleteAttribute 352
System.OutOfMemoryException 354
System.OverflowException 356
System.IO.Path 359
System.IO.PathTooLongException 365
System.Security.PermissionSet 367
System.Security.Permissions.PermissionState Enum 373
System.Random 375
System.RankException 378
System.SByte Structure 381
System.Security.Permissions.SecurityAction Enum 384
System.Security.Permissions.SecurityAttribute 386
System.Security.SecurityElement 388
System.Security.SecurityException 390
System.Security.Permissions.SecurityPermission 392
System.Security.Permissions.SecurityPermissionAttribute 395
System.Security.Permissions.SecurityPermissionFlag Enum 398
System.IO.SeekOrigin Enum 400
System.Single Structure 402
System.StackOverflowException 406
System.IO.Stream 408
System.IO.StreamReader 414
System.IO.StreamWriter 417
System.String 420
System.Text.StringBuilder 429
System.IO.StringReader 434
System.IO.StringWriter 436
System.Threading.SynchronizationLockException 438
System.SystemException 440
System.IO.TextReader 443
System.IO.TextWriter 445
System.Threading.Thread 448
System.Threading.ThreadAbortException 452
System.Threading.ThreadPriority Enum 454
System.Threading.ThreadStart Delegate 456
System.Threading.ThreadState Enum 458
System.Threading.ThreadStateException 461
System.Threading.Timeout 463
System.Threading.Timer 465
System.Threading.TimerCallback Delegate 468
System.TimeSpan Structure 470
System.Type 474
System.TypeInitializationException 484
System.UInt16 Structure 487
System.UInt32 Structure 490
System.UInt64 Structure 493
System.UnauthorizedAccessException 496
System.Globalization.UnicodeCategory Enum 498
System.Text.UnicodeEncoding 500
System.Text.UTF8Encoding 503
System.ValueType 507
System.Security.VerificationException 510
System.Version 512
System.Threading.WaitHandle 515

Annotations Index 519
Index 521

Foreword

When I began my standards "career" back in August 2000, "ECMA" and "ISO" meant as much to me as the sequence of letters in the daily newspaper jumble. I hadn't a clue on how the standards process actually worked, from either a technical or a political perspective. Now, as I write this, I am chair of the ECMA committee that oversees the standardization of programming and scripting languages. In addition, I am convener of the task group within the committee that is responsible for the standardization of the CLI, on which, of course, the content of this book is based.

In 2000, Microsoft publicly introduced its .NET vision. A key component of this vision is the .NET Framework, which includes a set of class libraries and a virtual machine ("runtime engine") to execute next-generation applications.

In September 2000, Microsoft, co-sponsored by Intel and Hewlett-Packard, formally submitted a core subset of the .NET Framework to ECMA International, a renowned international standards organization. The submission was entitled the Common Language Infrastructure, or CLI. The meeting was held in Bristol, England, with representatives from companies such as IBM and Sun Microsystems. Microsoft presented the CLI to ECMA's Programming and Scripting Languages Technical Committee, or TC39. It was decided by unanimous consent that the CLI would be added to the program of work for TC39 and that a new task group, called the TG3, would be responsible for the standardization effort. One might ask what happened to TG1 and TG2. Before the submission of the CLI, the TC39 was responsible for the standardization of only ECMAScript. There were no task groups, per se. When the CLI was approved for work, ECMAScript was moved to a newly formed TG1. C#, which was submitted at the same time as the CLI, introduced the TG2. The TG3 was reserved for the CLI. There is now even a TG4 responsible for the standardization of the Eiffel programming language and a TG5 chartered to standardize a binding between ISO C++ and the CLI.

There are two primary facets to the CLI standardization process within ECMA, the virtual machine and the class libraries. The virtual machine provides the environment necessary to execute applications written for the CLI. The class libraries provide the core infrastructure to enable developers to create libraries and applications for execution on top of the virtual machine.

I am involved in both facets of the standardization process, but I have enjoyed the class library aspect the most. This is primarily because I have a better understanding of that level of the development stack than I do the lower layers, such as where the virtual machine would lie. And since Brad Abrams was the Microsoft lead in the class library standardizatio effort, my good relationship with him began.

The set of class libraries submitted to ECMA International are, from a .NET Framework perspective, relatively small. However, they definitely provide the foundation upon which all other class libraries are built. The class library was segmented into what the standard calls "profiles." The kernel profile consists of the base types that would be expected to exist in modern programming languages (as well as types to assist compilers for those languages). String and Int32 are examples of such types. The kernel profile must be implemented in order to claim conformance to the standard. The compact profile consists of the kernel pro- file, plus some types necessary to implement basic Web services-type applications while maintaining a small enough footprint to fit on standard compact, connected devices. Then there are some types that do not fit any profile, but can be implemented as part of any profile. These include types dealing with floating point numbers and multidimensional arrays. Brad's book concentrates on the base types that are part of the kernel profile, as well as the extended numerics (e.g., floating point and decimal). For information on the concept behind the segmentation of the class libraries into profiles, see Partition IV of the ECMA Standard ECMA-335, also published as ISO/IEC 23271. The ECMA Standard can be downloaded-- and freely copied--free of charge from http://www.ecma-international.org.

The process by which we standardized the base types associated with kernel profile was systematic, and yet churned out some very interesting and heated discussion. There was an initial cursory review of all of the libraries in order to weed out any obvious errors and missing data. Then came the detailed reviews. We started with the type of all types, System.Object. This served as the model of the process we would use to do the rest of the detailed reviews. The task group members would work offline and formulate individual comments on the type. Then at the meeting we would go page by page, method by method, property by property to see if there were any comments. Brad, who managed the editing process at Microsoft, took the comments back and incorporated them. Finally, the task group would review the type again with the incorporated changes and consider it final. Of course, if the task group just reviewed one type per meeting, we would still be reviewing the class libraries. After System.Object, the base types were divided into relatively equal parts, and at each meeting the task group would review one of those parts. To expedite the process, a subgroup of people were assigned as primary reviewers for certain types. Thus, committee members weren't overwhelmed by having to do detailed analysis and commentary on all types.

If all we did at the meetings were editorial reviews of the types--fixing punctuation here and changing a word there--they would have been quite boring. (Actually, come to think of it, it would have been amazing if that were the case--no substantial changes were needed to the class libraries because they were already perfect!) I mentioned that some interesting and heated discussion occurred during the reviews of the class libraries. This was because they were, of course, not perfect, and thus illustrate the benefit and relevance of the standardization process. You will see many annotations in this book that are examples of cool discussion, so I won't dive into it much here, but one instance definitely sticks out as a whopper. It was within the System.Decimal structure, where the original speci- fication of the ToString() method did not preserve the scale (trailing zeros) during conversion (even though it maintained scale internally, it was not exposed through conversions back and forth from String). For example, given a decimal value of 134.320000, it can be noted that this has a scale of 6. Calling the ToString() method would produce a string with the characters 134.32, making a decimal value with a scale of 2. This was deemed the wrong thing to do. Now one must remember that the .NET Framework 1.0 had already been shipped to millions of customers. Even so, the change was made to the specification and, even more important, Microsoft staff agreed to this change even though it would break code. They knew, however, it was the right thing to do. Indeed, standardization can be quite interesting!

The class library specifications were submitted to ECMA International, but not as the Microsoft Word or Adobe PDF documentation that one would expect. Instead they were submitted in XML format. This was done for various reasons, but the primary one was so that implementers could create documentation in any form they chose (HTML, Word, PDF, etc.) using well-known XSLT techniques and other mechanisms. It allowed for a lot of freedom in the documentation. Of course, no one (at least no one of sound mind) is going to read 10 MB of raw XML, let alone use it as the means to review the types. Thus a way to convert the XML to Word was needed. A managed code-based tool was developed by one of the task group members using XSLT and COM Interop to access the Word APIs (I am usually very humble, so I won't mention the tool author by name, but...). This turned out to be very valuable because it produced human-readable documentation. It also saved months of manual editing and formatting because the tool allowed edits to be made to the XML only, and then it would take care of the rest. The tool was also versatile. It did not just generate Word documents. For example, the type, method, and property signatures you see in this book--even those in the C# standard--are based on the running of the conversion tool. It was actually quite fun to develop. Not everyone was convinced of the benefits of the XML, and there was some controversy regarding the submission of the class libraries in that format (although ECMA had already developed another standard in this format); it even caused one delegation within ISO to vote against accepting the standard at first. After discussion, however, the XML format was accepted as an appropriate submission mechanism. The tool, and the results it produces, is published as ECMA TR/84, which is also freely available from the ECMA Web site.

Some people may ask why the CLI was submitted for standardization in the first place. Yes, it's true that the current standard CLI specification alone will not allow developers to implement a majority of real-world applications (e.g., I doubt Quake could be etched out of the standard library set). However, it is, in my mind, a near-perfect base to begin such an implementation. Also, the industry has accepted the standard. Intel's Open Class Libraries (OCL), as well as other public projects, are based on what the standard has to offer (the licensing arrangements for the standard are very kind, which helps here, but I won't get into that). It provides a cookbook for researchers to do work in the area of managed runtime environments, knowing that this cookbook is based on a highquality and widely used commercial implementation. It also provides a foundation for future technologies to be added to the standard, which is already evident in the work happening to the next edition of the standard.

The first edition of the standard was ratified by ECMA in December 2001, and approved by ISO in October 2002 (which became Edition 2 of the ECMA standard in December 2002 because minor edits were made during the ISO review process). Work on Edition 3 is occurring as I write this, and some interesting libraries are being considered in the area of generics and threading.

The specification itself, while important in implementing the CLI class libraries, could be construed as very dry reading. It is, after all, primarily a cookbook specifying what must be included in a successful class library recipe. .NET Framework Standard Library Annotated Reference, Volume 1, adds some pizzazz to the standard. Annotations are not typically an official part of a standard, and rightly so, as a standard must be as clear and concise as possible, only providing necessary information for implementation. However, if I were a developer using the CLI class libraries (heck, even if I were an implementer of the libraries), this book would be my primary tool. Why? Because it provides you with all the information of the official standard, but also includes firsthand insight, examples, and occasionally a little humor by those who developed it. And those added extras could answer a lot of the "Why was this done that way?" questions that many developers have.

Some quick praise for the author of this book, Brad Abrams: It is obvious that he is a content guru. In addition, it was his leadership in producing the specifications, accepting (most of the time) and incorporating changes, and reproducing the results in a timely manner, that enabled this standard to be produced in the time frame it was.

For me, the journey from alphabet soup to where we are today has been an interesting ride. I like to think my hard work during the process and my passion for what was being standardized led me to the ECMA positions I hold today. But if it weren't for the dedication of people like Brad, who was instrumental in getting the first edition of the standard out the door, I am not sure there would be such positions in the first place.

Step into the minds of the people who actually made the standard class libraries happen, and enjoy the book.

Joel Marcey
Intel Corporation
Chair of TC39
Convener of TG3

The views expressed in this Foreword do not necessarily reflect the views of Intel Corporation, its affiliates, its subsidiaries, or its employees.

Index

Download the Index file related to this title.

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020