Errata

C# 3.0 Pocket Reference

Errata for C# 3.0 Pocket Reference

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Printed
Page 6
First line

Change:

static int InchesToFeet (int feet) {...}

to:

static int FeetToInches (int feet) {...}

Joseph Albahari
Joseph Albahari
 
Sep 04, 2008  Dec 01, 2008
Printed
Page 9
List of keywords

The list of keywords contains "news", which is not a keyword. It should be replaced with "new".

Anonymous  Nov 28, 2009 
Printed
Page 9
list of keywords

Surely 'volatile' is a keyword in C# 3.0? It's not in the list on page 9. As an aside, adding this in to the list, where it belongs, would bring the grand total of keywords and contextual keywords to 100! That's got to be worth doing.

Note from the Author or Editor:
Add 'volatile' to the list of keywords in that table

Michael Callaghan  Jun 26, 2009  Aug 01, 2009
Other Digital Version
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.


Anonymous    May 01, 2008
Printed, Other Digital Version
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.

Anonymous  Jan 08, 2009  Jun 01, 2008
Printed
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.


Anonymous    Jun 01, 2008
Other Digital Version
20
first item of first bullet near bottom of page

Value types
Numeric types
- Signed integer (byte, short, int, long)

byte should be sbyte

Anonymous    May 01, 2008
Other Digital Version
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)

Anonymous    May 01, 2008
Printed, Other Digital Version
Page 20
first item of first bullet near bottom of page

Value types
Numeric types
- Signed integer (byte, short, int, long)

byte should be sbyte

Anonymous  Jan 08, 2009  Jun 01, 2008
Printed, Other Digital Version
Page 20
Second item of the first bullet about 2/3 down the page

The third item of Unsigned Integer should be uint, not unit.

Note from the Author or Editor:
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)

Anonymous  Jan 08, 2009  Jun 01, 2008
Printed
Page 20
first item of first bullet near bottom of page

Value types
Numeric types
- Signed integer (byte, short, int, long)

byte should be sbyte

Anonymous    Jun 01, 2008
Printed
Page 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)

Anonymous    Jun 01, 2008
Other Digital Version
21
Chart

The signed types are labelled unsigned, and vice versa.

Anonymous    May 01, 2008
Other Digital Version
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

Anonymous    May 01, 2008
Printed, Other Digital Version
Page 21
Numeric Types table

Headings "Integral - Unsigned" and "Integral - Signed" are reversed.

This is in the 2nd Edition.

Another unconfirmed errata says that the C# type entries are reversed for each line under the above mentioned headings. However, the types match the rest of the data on their respective lines. So, it is the headings that are reversed.

Note from the Author or Editor:
The table headings "Integral - Unsigned" and "Integral - Signed" should be swapped on page 21. Note that this has been fixed in the second printing.

Anonymous  May 15, 2008  Jun 01, 2008
Printed
Page 21
Chart

The signed types are labelled unsigned, and vice versa.

Anonymous    Jun 01, 2008
Printed
Page 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

Anonymous    Jun 01, 2008
Printed
Page 22
"Numeric literal type interface" heading, 2nd bullet

For the sentence:
"Otherwise, the literal's type is the first type in this list that can fit the literal's value: int, uint, ulong, and long"

The order of the types in the list is incorrect. The correct order is:
"int, uint, long, and ulong

Anonymous  Nov 28, 2009 
Other Digital Version
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.

Anonymous    May 01, 2008
Printed, Other Digital Version
Page 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.

Anonymous  Jan 08, 2009  Jun 01, 2008
Printed
Page 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.

Anonymous    Jun 01, 2008
Other Digital Version
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.

Anonymous    May 01, 2008
Printed, Other Digital Version
Page 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, ..."

Note from the Author or Editor:
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.

Anonymous  Jan 08, 2009  Jun 01, 2008
Printed
Page 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.

Anonymous    Jun 01, 2008
Other Digital Version
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).

Anonymous    May 01, 2008
Printed, Other Digital Version
Page 65
second paragraph

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).

Anonymous  Jan 08, 2009  Jun 01, 2008
Printed
Page 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).

Anonymous    Jun 01, 2008
Other Digital Version
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.

Anonymous    May 01, 2008
Printed, Other Digital Version
Page 80
the heading "Partial Classes and Methods"

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.

Anonymous  Jan 08, 2009  Jun 01, 2008
Printed
Page 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.

Anonymous    Jun 01, 2008
Other Digital Version
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:

Anonymous    May 01, 2008
Printed, Other Digital Version
Page 81
first sentence in "partial methods" paragraph

Change to:
A partial type may contain partial methods. Partial methods let an auto-generated partial types
provide customizable hooks for manual authoring. For example:

Anonymous  Jan 08, 2009  Jun 01, 2008
Printed
Page 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:

Anonymous    Jun 01, 2008
Other Digital Version
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
...


Anonymous    May 01, 2008
Printed, Other Digital Version
Page 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;

Note from the Author or Editor:
the first line (on bold) on page 124 should read:

public event PriceChangedHandler PriceChanged;

public decimal Price
...

Anonymous  Jan 08, 2009  Jun 01, 2008
Printed
Page 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
...


Anonymous    Jun 01, 2008
Printed
Page 131
1 line of example in 2nd paragraph

delegate TResult Func <T> ();

should read

delegate TResult Func <TResult> ();

Note from the Author or Editor:
First line in first code listing on page 131:
delegate TResult Func <T> ();

Should be:
delegate TResult Func <TResult> ();

Anonymous  Jun 23, 2008  Dec 01, 2008
Printed
Page 131
First line in first code listing on page 131

Description: delegate TResult Func ();

should read

delegate TResult Func <TResult> ();

Anonymous    Dec 01, 2008
Other Digital Version
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.

Anonymous    May 01, 2008
Printed, Other Digital Version
Page 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.

Anonymous  Jan 08, 2009  Jun 01, 2008
Printed
Page 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.

Anonymous    Jun 01, 2008
Other Digital Version
173
- first code listing, Group should be GroupBy

Where, Select, SelectMany
OrderBy, ThenBy, OrderByDescending, ThenByDescending
GroupBy, Join, GroupJoin

Anonymous    May 01, 2008
Printed, Other Digital Version
Page 173
first code listing

Group should be GroupBy:

Where, Select, SelectMany
OrderBy, ThenBy, OrderByDescending, ThenByDescending
GroupBy, Join, GroupJoin

Anonymous  Jan 08, 2009  Jun 01, 2008
Printed
Page 173
- first code listing, Group should be GroupBy

Where, Select, SelectMany
OrderBy, ThenBy, OrderByDescending, ThenByDescending
GroupBy, Join, GroupJoin

Anonymous    Jun 01, 2008
Other Digital Version
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.

Anonymous    May 01, 2008
Printed, Other Digital Version
Page 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)

Note from the Author or Editor:
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.

Anonymous  Jan 08, 2009  Jun 01, 2008
Printed
Page 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.

Anonymous    Jun 01, 2008