In fact, the author is mistaken.
class Sample<T> where T : class, Stream, new()
(which is the supposedly valid example given) is invalid too, because it's redundant. If T
derives from Stream
(which is a class) then it's clearly going to be a reference type.
The second example is also invalid, but this time because the class/struct constraint has to come first (like the constructor constraint has to come last).
There are rumours that this is fixed in the second edition. Sources close to the author indicate that the first example may have been changed to:
class Sample<T> where T : class, IDisposable, new()
Personally I think it's shocking that a mistake such as this made it past the technical reviewer for the first edition ;)