The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

MickeyP (23) [Avatar] Offline
#1
Hi Jon,

Having difficulty understanding Listing 4.5 on page 132. You've indicated that these are two different versions, one using an output parameter, and the other using nullable types.

Sorry but can't quite understand this, I cant find any TryParse method with a single parameter in the framework - the only ones I can see have an output parameter, and so it appears to me that the code at the bottom of the listing calls the code at the top, but then its no longer two versions as you have stated in the text.

I expect I'm probably missing something, but can't quite see it.

Cheers, Mickey
jon.skeet (483) [Avatar] Offline
#2
Re: Listing 4.5, TryParse, p 132
Yes, the code at the bottom (which Snippy builds as the main method) calls the TryParse at the top - but the code at the top calls the framework's TryParse method. So there are two styles of TryParse within the listing - that's what I was getting at. (I don't have my copy of the book to hand to check the exact wording - I'll have a look when I get home. I'm pretty sure that's what I meant though.)

Jon
MickeyP (23) [Avatar] Offline
#3
Re: Listing 4.5, TryParse, p 132
Thanks, from the text I got the impression that these were meant to be alternative versions, which is what threw me. Perhaps I'm the exception here! smilie