Errata

C# Essentials

Errata for C# Essentials

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 2
Changed "Safe type system" to "Type safety and a unified type system"

and changed "Automatic memory management" to "Automatic and manual memory
management."

Anonymous    Apr 01, 2001
Printed
Page 3

Line 2 of the 2nd paragraph did read:

".NET compiles source code and produces..."

Now reads:

".NET compiles source code into..."

Anonymous    Apr 01, 2001
Printed
Page 5
last paragraph

The first sentence claims that to compile Test.cs one should run "cs Test.cs".
The compiler is csc, not cs, so this text should be "csc Test.cs".

Anonymous   
Printed
Page 5
Replaced the section "A Minimal C# Program" with the following text

<heada>A First C# Program</heada>

Here is a simple C# program:

namespace FirstProgram {
using System;
class Test {
static void Main () {
Console.WriteLine ("Welcome to C#!");
}
}
}

A C# program is composed of types (typically classes) that we organize into
namespaces. Each type contains function members (typically methods), as well
as data members (typically fields). In our program, we define a class named
<lit>Test</lit> that contains a method, named <lit>Main</lit>, that writes
<lit>Welcome to C#!</lit> to the <lit>Console</lit> window. The
<lit>Console</lit> class encapsulates standard input/output functionality,
providing methods such as <lit>WriteLine</lit>. To use types from another
namespace, we use the <lit>using</lit> directive. Since the <lit>Console</lit>
class resides in the <lit>System</lit> namespace, we go <lit>using
System</lit>; similarly, types from other namespaces could use our
<lit>Test</lit> class by going <lit>using FirstProgram</lit>.

In C#, there are no standalone functions; functions are always associated with
a type, or as we will see, instances of that type. Our program is simple, and
makes use of only static members, which means the member is associated with
its type, rather than instances of its type. In addition, we make use of only
void methods, which means these methods do not return a value. Of final note
is that C# recognizes a method named <lit>Main</lit> as the default entry
point of execution.

Anonymous    Apr 01, 2001
Printed
Page 8

The first sentence of the 2nd paragraph did read:

"Implicit conversions are guaranteed to succeeed and not lose
information."

Now reads:

"The rationale behind implicit conversions is that they are guaranteed
to succeed and not lose information."

Anonymous    Apr 01, 2001
Printed
Page 9
bottom of page; there is an unnecessary space before "int"

Anonymous   
Printed
Page 11
In the 3rd code line, changed "strenngtgth" to "strength".

Anonymous    Apr 01, 2001
Printed
Page 11
In the table under "decimal type", changed the 12 in the righthand column

to a 16.

Anonymous    Apr 01, 2001
Printed
Page 12
bool type, last sentence:

s/a array/an array/

Anonymous   
Printed
Page 14
In the first line under "Memory for reference types," changed "The

memory location of a..." to "The memory of a..."

Anonymous    Apr 01, 2001
Printed
Page 15

The 5th line of code did read:

// object's type synchronization state

Now reads:

// object's type & synchronization state

Anonymous    Apr 01, 2001
Printed
Page 18
definite assignment:

The ast sentence reads, "a warning is generated if the line v = a is commented
out". This is true, but it is not because a default value is assigned to a
field that was never explicitly assigned. The warning is because the field is
never used. We should remove this last sentence.

Anonymous   
Printed
Page 21
In the first line under "Statements," changed "Execution off" to

"Execution of."

Anonymous    Apr 01, 2001
Printed
Page 22
2nd paragraph, 2nd-to-last sentence:

s of statement font is different.

Anonymous   
Printed
Page 22
In the first and third lines of the first full code block, removed "int"

at beginning of lines. They now read:

x = 5 + 6; // assign result
...
y = Math.min(x, 20); // side effect and assign result

Anonymous    Apr 01, 2001
Printed
Page 25
do-while loops syntax:

s/statement o -statement-block/statement-or-statement-block/

Anonymous   
Printed
Page 25
while loops syntax:

s/statement or statement-block/statement-or-statement-block/ (Also make sure
this is all in italics; the or currently isn't.)

Anonymous   
Printed
Page 35
1st sentence:

s/base class must explicitly/base class should explicitly/

Anonymous   
Printed
Page 35
replace code fragment

public class Base { // written by the library people
public virtual void Foo() {...} // added in latest update
}
public class Derived : Base { // written by you
public void Foo() {...} // not intended as an override
}

Anonymous   
Printed
Page 35
In the second line under "Versioning Virtual Function Members," changed

"the virtual method of a class or interface."

to:

"a virtual method."

Anonymous    Apr 01, 2001
Printed
Page 38
first paragraph; The first sentence should read: "Includes fields,

constants, and events.

Anonymous   
Printed
Page 38
Differences between Classes and Structs:

Words for first bullet s/structs typically simple types, whereas value-type
semantics/structs are typically simple types were value semantics/

Anonymous   
Printed
Page 38

The second sentence in the first bulleted item did read:

"Consequently, structs typically simple types, whereas value-type
semantics are desirable..."

Now reads:

"Consequently, structs typically represent simple types, whereby
value-type semantics are desirable..."

Anonymous    Apr 01, 2001
Printed
Page 39
last paragraph

s/A read-only field is always evaluated/Assignment to a read-only field is
always evaluated/

s/To compile, a nonread-only field/To compile, a read-only field/

Anonymous   
Printed
Page 41
properties syntax:

The [ before virtual is in italics. Also, the last "attributes? set
statement-block" line should not have a | on the end of it.

Anonymous   
Printed
Page 46
Operators:

missing ==, please add.

Anonymous   
Printed
Page 57
s/type [*]+ /type[*]+ array-name /. array-name should be in italics.

Anonymous   
Printed
Page 57

The line under the "Arrays" heading did read:

type [*]+ = new type [ dimension+ ][*]*;

Now reads:

type [*]+ array-name = new type [ dimension+ ][*]*;

Anonymous    Apr 01, 2001
Printed
Page 58
Deleted the 5th line in the first code block (same as line 4).

Anonymous    Apr 01, 2001
Printed
Page 60
code fragment:

s/Toggle tog = (Switch)Enum.FromString/Toggle tog = (Toggle)Enum.FromString/

Anonymous   
Printed
Page 61
In the first paragraph under "Delegates," the following text has been

changed to a footnote:

"The signature of a delegate method includes its return type and also
allows the use of a params modifier in its parameter list, expanding
the list of elements that characterize an ordinary method signature.
The actual name of the target method is irrelevant to the delegate."

Anonymous    Apr 01, 2001
Printed
Page 67
Changed the heading "catch Statement" to "catch".

Anonymous    Apr 01, 2001
Printed
Page 74
The #define statement is effectively equivalent to #define true (drop the

=).

Anonymous   
Printed
Page 82
In the list under the Object class definition, changed "Object(object o)"

to "Object()", and "Equals()" to "Equals(object o)".

Anonymous    Apr 01, 2001
Printed
Page 86
3rd paragraph

The last sentence reads:

(see the laster section "Strings").

It should read:

(see the latter section "Strings").

Anonymous   
Printed
Page 95
last sentence:

s/returns if/returns false if/

Anonymous   
Printed
Page 109
s/First, execution may leave the lock statement blocked/First, execution

may leave the scope of the lock statement block

Anonymous   
Printed
Page 127
bullet 4:

s/attribute, may/attribute may/

Anonymous   
Printed
Page 131
3rd paragraph, last sentence:

s/object/objects/

Anonymous   
Printed
Page 139
code fragment:

This no longer compiles because Microsoft updated MSN Instant Messenger -
replace with this code frag:

// SetFN.cs - compile with /r:Messenger.dll
// Run SetFN.exe <Name> to set the FriendlyName for
// the currently logged-in user
// Run TlbImp.exe "C:Program FilesMessengermsmsgs.exe"
// to create Messenger.dll
using Messenger; // COM API for MSN Instant Messenger
public class MyApp {
public static void Main(string[] args) {
MsgrObject mo = new MsgrObject();
IMsgrService im = mo.Services.PrimaryService;
im.FriendlyName = args[0];
}
}

Also, update the leadin sentence as follows: s/example demonstrates adding a
contact to MSN/example demonstrates changing the friendly name of the user
with MSN/.

Anonymous   
Printed
Page 142
1st sentence:

s/to one/to use one/

Anonymous   
Printed
Page 144
s/ILAsm.exe/ILDasm.exe/

Anonymous   
Printed
Page 144
s/see the String namespace/see the String class/

Anonymous   
Printed
Page 146
s/System. Activator/System.Activator/

Anonymous   
Printed
Page 160

The definition of decimal did read:

"A twelve-bit precise decimal datatype."

Now reads:

"A sixteen-bit precise decimal datatype."

(colophon) The second paragraph in the colophon did read:

"The animal on the cover of C# Essentials is a star-nosed mole
(condylura cristata)..."

Now reads:

"The animal on the cover of C# Essentials is a star-nosed mole
(Condylura cristata)..."

Anonymous    Apr 01, 2001
Printed
Page 161
for definition:

s/stopping-condition/continuation-condition/

Anonymous   
Printed
Page 163
return definition:

s/nonvoid/non-void/

Anonymous   
Printed
Page 163
sealed definition:

s/derived-from/derived from/

Anonymous