C# 3.0 Pocket Reference, Second Edition By Joseph Albahari, Ben Albahari The following errata were *corrected* in the 6/08 reprint: Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification +n: n'th paragraph from the top of the page -n: n'th paragraph from the bottom of the page (15) last paragraph, second sentence: The public keyword exposes members to other classes. In this example, if the Name field in Panda was not public, the Test class could not call it. The word call should be replaced with access: The public keyword exposes members to other classes. In this example, if the Name field in Panda was not public, the Test class could not access it. (20) first item of first bullet near bottom of page; Value types Numeric types - Signed integer (byte, short, int, long) byte should be sbyte (20) Second item of the first bullet about 2/3 down the page; The third item of Unsigned Integer should be uint, not unit. Confirm - the text should read as follows: Value types Numeric types Signed integer (sbyte, short, int, long) Unsigned integer (byte, ushort, uint, ulong) Real number (float, double, decimal) {21} Chart; The signed types are labelled unsigned, and vice versa. (21) table in middle of page; The first two subheadings should be swapped. Integral - unsigned contains the signed integer types. Integral - signed contains the unsigned integer types. Confirm - the table should read as follows: C# type System type Suffix Size Range Integral—signed sbyte SByte 8 bits –27 to 27–1 short Int16 16 bits –215 to 215–1 int Int32 32 bits –231 to 231–1 long Int64 L 64 bits –263 to 263–1 Integral—unsigned byte Byte 8 bits 0 to 28–1 ushort UInt16 16 bits 0 to 216–1 uint UInt32 U 32 bits 0 to 232–1 ulong UInt64 UL 64 bits 0 to 264–1 (22) second paragraph: add a footnote after the words “floating-point types”: Of the real number types, float and double are called floating-point types* The footnote should read: *Technically, decimal is a floating-point type too, although it’s not referred to as such in the C# language specification. {32} second line; Currently reads, "In the preceding example, if it is not windy, the expression (rainy || sunny) is not even evaluated." The relevant code of the preceding example is: return ! windy && (rainy || sunny); So, because of short circuit evaluation, if the first expression (! windy) is false, then the second expression will not be evaluated. For !windy to be false, windy must be true. So, the second line of page 32 should read, "...if it is windy, ..." Confirm - the word “not” should be removed from the second sentence on page 32, so that it reads as follows: In the preceding example, if it is windy, the expression (rainy || sunny) is not even evaluated. (65) second paragraph should read: The using statement provides an elegant syntax for calling Dispose on objects that implement IDisposable (see “try Statements and Exceptions” later in the book). (80) the heading “Partial Classes and Methods” should read “Partial Types and Methods”. Also, the opening sentence should start: Partial types allow a type definition... The remainder of the paragraph is OK. However, the third paragraph should have the word ‘classes’ replaced with ‘types’ as follows: Participants cannot have conflicting members. A constructor with the same arguments, for instance, cannot be repeated. Partial types are resolved entirely by the compiler, which means that each participant must be available at compile time and must reside in the same assembly. (81) heading “partial methods”, first sentence in paragraph should read as follows: A partial type may contain partial methods. Partial methods let an auto-generated partial types provide customizable hooks for manual authoring. For example: {124} 1st line; Previous page (123) defines delegate PriceChangedHandler and begins definition of class Stock. Top of page 124 defines event PriceChanged, but reads: public event PriceChanged PriceChanged; Should read: public event PriceChangedHandler PriceChanged; Confirm - the first line (on bold) on page 124 should read: public event PriceChangedHandler PriceChanged; public decimal Price ... (138) section “The using statement” - the last sentence in the paragraph should be changed as follows: Many classes encapsulate unmanaged resources, such as file handles, graphics handles, or database connections. These classes implement System.IDisposable, which defines a single parameterless method named Dispose to clean up these resources. The using statement provides an elegant syntax for calling Dispose on an IDisposable object within a finally block. (173) - first code listing, Group should be GroupBy: Where, Select, SelectMany OrderBy, ThenBy, OrderByDescending, ThenByDescending GroupBy, Join, GroupJoin [193] Table 15, 9th entry "#line"; "hidden specifies that the compiler should generate debugger information" doesn't make any sense here. The hidden directive "hides the successive lines from the debugger, such that when the developer steps through the code, any lines between a #line hidden and the next #line directive will be stepped over." (MSDN) Confirm - the text should read (also note the straight quotes): #line [ number ["file"] | hidden] number specifies the line in source code; file is the filename to appear in computer output; hidden instructs debuggers to skip over code from this point until the next #line directive.