A Programmer's Introduction to C# 2.0, Third Edition. 

Errata

Chapter 7 - Member Accessibility and Overloading, Page 58

Change the code that reads:

In the first call to Process(), an int is passed as an argument. This matches the long version of the function because there’s an implicit conversion from int to long and no implicit conversion from int to short.

to

In the first call to Process(), an int is passed as an argument. This matches the long version of the function because there’s an implicit conversion from int to long and no implicit conversion from int to sbyte.

Chapter 8 - Other Class Details, Page 73

Change the code that reads:

// call to new can't be used with static

to

// call to new can't be used with const

Change the text that reads:

This clearly doesn’t work because the static members Red, Green, and Blue can’t be calculated at compile time.

to

This clearly doesn’t work because the const members Red, Green, and Blue can’t be calculated at compile time.

Chapter 18 - Strings - Page 162

Remove the line that reads:

char[] separators = {' ', ','};

Chapter 18 - Strings - Page 163

Replace the following table entry:

Multiline Changes the meaning of the caret (^) and question mark ($) so they match at the beginning or end of any line, not the beginning or end of the whole string

with:

Multiline Changes the meaning of the caret (^) and dollar sign ($) so they match at the beginning or end of any line, not the beginning or end of the whole string

Chapter 18 - Strings - Page 167

Change the code that reads:
Marshal.SecureStringToGlobalAllocUni( ss );

to:

Marshal.SecureStringToGlobalAllocUnicode( ss );

Chapter 20 - Page 186 - Enumerators:

Change the code that reads:

using System;
using System.Collections;
 
// Note: This class is not thread-safe
public class IntList: IEnumerable
{
 int[] values = new int[10];
 int allocated = values.Length;
 int count = 0;

to:

using System;
using System.Collections;
 
// Note: This class is not thread-safe
public class IntList: IEnumerable
{
 int[] values;
 int allocated;
 int count;
 
public IntList()
{
 values = new int[10];
 allocated = values.Length;
count = 0;
}

Chapter 20, Indexers, Enumerators and Iterators, Page 188

Change the code that reads:

class IntListEnumerator

to:

public class IntListEnumerator

Chapter 22, Attributes, Page 214:

Change the code that reads:

Type type = typeof(Complex);
foreach (CodeReviewAttribute att in type.GetCustomAttributes(typeof(CodeReviewAttribute), false))
{
 CodeReviewAttribute att = (CodeReviewAttribute) atts[0];
 Console.WriteLine("Reviewer: {0}", att.Reviewer);
 Console.WriteLine("Date: {0}", att.Date);
 Console.WriteLine("Comment: {0}", att.Comment); }
}

to:

Type type = typeof(Complex);
foreach (CodeReviewAttribute att in type.GetCustomAttributes(typeof(CodeReviewAttribute), false))
{
 Console.WriteLine("Reviewer: {0}", att.Reviewer);
 Console.WriteLine("Date: {0}", att.Date);
 Console.WriteLine("Comment: {0}", att.Comment); }
}

Chapter 27, Attributes, Page 268:

Change the code that reads:

int j = Nullable.GetValueOrDefault<int>(i); // returns 0

to:

int j = i.GetValueOrDefault(); // returns 0

Change the code that reads:

j = Nullable.GetValueOrDefault<int>(i); // returns 123

to:

j = i.GetValueOrDefault(); // returns 123