A closing bracket is missing the second example. The code should be:
throw new KeyNotFoundException(
string.Format("No calendar system for ID {0} exists", id));
The declaration for the LastOrDefault
method is missing the type parameter T. The first line should be
public T LastOrDefault<T>(IEnumerable<T> source)
"That type representing a favorite color and type isn't likely to be useful anywhere else" should be: "That type representing a favorite color and count isn't likely to be useful anywhere else"
The expansion of the != operator applied to tuples is incorrect. The expansion
Console.WriteLine(t1 != t2);
should be
Console.WriteLine(t1.Item1 != t2.Item1 ||
t1.Item2 != t2.Item2 ||
t1.Item3 != t2.Item3)
The difference is the use of the || operator; in the book I used the && operator.
Between the code and output, change "The output is mostly straightforward, but you may be surprised by the penultimate line:" to "The output is mostly straightforward, but you may be surprised by the last line:" because it's actually the last line of output that's surprising.
The code in the Main method on page 397 is incorrect. Please replace it with the following:
static void Main()
{
int x = 10;
InParameter(x, () => x++);
int y = 10;
ValueParameter(y, () => y++);
}
The compiler then uses that information to warn you if try to misuse a value that might be null.
should be
The compiler then uses that information to warn you if you try to misuse a value that might be null.