OmarShraim (2) [Avatar] Offline
#1
In Chapter05 VB.NET solution, some code in the btnForEach_Click routine is commenetd. The explanation shown in the comments

' The calls to ForEach in the statements below produce the following
' error at compile-time: "Expression does not produce a value".

The code can compile by changing

txtDesignPatternsResults.AppendText(book.Title + Environment.NewLine)

to

String.Concat(txtDesignPatternsResults.Text, book.Title, Environment.NewLine)

This means the WARNING in the Book, page 186 should be modified accordingly

Message was edited by:
OmarShraim
fabrice.marguerie (224) [Avatar] Offline
#2
Re: Chapter5 VB code
Thank you for your comment, Omar.
However, this doesn't work because String.Concat returns a new string, but doesn't change the text in the TextBox, which is what we're trying to achieve.
I left the code on purpose. The goal here is also to show that VB does not offer support for statement lambdas.