C# in Depth

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

Only one empty string, not two - and Snippy oddities

Chapter 3: Parameterized typing with generics: P 67, first paragraph

Created: 12/24/2008
Last updated: 12/24/2008
Severity: Technical error

The text in the first paragraph on P67 currently includes:

It's crude - we end up with two empty strings (one at each end of the text)

In fact, we only get a single empty string - it's due to the period at the end of "green eggs and ham." The regular expression sees a non-word character, so splits "ham." into "ham" and "".

As an aside, this program currently works pretty weirdly in Snippy because it uses a #line directive before every single line to make the error messages work properly. That's fine normally, but not when there's a verbatim string literal involved! The text variable ends up with this text:

Do you like green eggs and ham?
#line 22
                        I do not like them, Sam-I-am.
#line 23
                        I do not like green eggs and ham

I'll try to fix it, but it's fun anyway...