C# in Depth

Incorrect code in listing 13.13 (Chapter 13)

The code in the Main method on page 397 is incorrect. It reuses a single variable (x) when calling ValueParameter after calling InParameter, leading to output that's not as described in the paragraph that follows.

The downloadable code contains (and has always contained) the correct Main method, which uses a separate variable so that the two method calls are independent of each other:

static void Main()
    int x = 10;
    InParameter(x, () => x++);

    int y = 10;
    ValueParameter(y, () => y++);

All errata