C# in Depth

Incorrect delegate compatibility claims with respect to conversions (Chapter 2)

On page 52, in this text:

Now imagine you wanted to create an instance of Printer to effectively wrap the PrintAnything method. It feels like it should be okay; a Printer will always be given a string reference, and that's convertible to an object reference via an identity conversion.

The end of that text should say "via an implicit reference conversion".

Likewise, on page 53, in the second paragraph, I say:

The compatibility between different parameter or return types has to be in terms of an identity conversion.

This should actually be:

The compatibility between different parameter or return types has to be in terms of an identity conversion or implicit reference conversion.

Note that this doesn't include user-defined conversions between reference types. For example, Action<string> isn't compatible with a method accepting an XNamespace, even though there's an implicit user-defined conversion from string to XNamespace.


All errata