C# in Depth

Cover of C# in Depth
Order now (3rd edition)

Accidental reversal of int and long in example

Chapter 4: Saying nothing with nullable types: P124, bottom paragraph

Created: 12/28/2008
Last updated: 12/28/2008
Severity: Typo

In the commentary on lifted conversions with nullable types, I use int and long as the examples for the S and T types in the specification. Unfortunately, in one place I got them the wrong way round. This sentence:

To carry our example forward, this means that you can convert implicitly from int? to long? and from int to long? as well as explicitly from long? to int.

should read

To carry our example forward, this means that you can convert implicitly from int? to long? and from int to long? as well as explicitly from int? to long.

(note the change in the last few words). In fact, it's still correct - there is an explicit conversion from long? to int, but only because of the explicit conversion from long to int.