More Effective C# provides items for C# 2 and C# 3. Generics and LINQ provide most of the content. Reading this book will make you proficient in the tecchniques that make up modern C# programming.
And, of course, no print edition is perfect. The errata page is here.
In Item 2, on page 17, you’ll see the following in the last sentence of the second paragraph:
“This is the design implemented in Equatable<T> and Comparable<T>".”
It should be:
“This is the design implemented in IEquatable<T> and IComparable<T>.”
The first text paragraph on p. 21 contains the phrase "if the constructor is being called for the first time". That should be "if GetEnumerator() is being called for the first time."
In Item 3, below the code snippet, the text refers to the wrong type. ReverseEnumerator<T>.GetEnumeratror() should be ReverseEnumerable<T>.GetEnumerator
The last line of the implementation for the > operator should read:
return left.CompareTo(right) > 0;
On p. 109, the last sample names the method UniqueV3. It should be Unique.
On p. 118, the text refers to using generics to create lists of different types. THe samples (as printed) show the closed generic types, rather than the generic methods.
The sample should show how you can use generics to create a sequence of different types. It should show:
List<double> listStorage = new List<double>(CreateDoubleSequence(100, 0, 5));
WIth a different version of CreateSequence:
static IEnumerable<double> CreateDoubleSequence(int, numberOfElements,
int startAt, int stepBy)
for (int i = 0; i < numberOfElements; i++)
yield return (double)(startAt + i * stepBy;}
The first line of p. 119 states "..., all 1,000 elements are generated, no matter..."
It should read:
"..., all 10,000 elements are generated, no matter..."p 191, wrong variable name in 3rd paragraph
In the third paragraph on .191, you'll see
"The variable incrementBy is modified after it has been placed in the closure..."
It should read:
"The variable index is modified after it has been placed in the closure..."