Feeds:
Posts
Comments

Posts Tagged ‘anonymous function’

Howdy,

In reference to my previous post, Pex: Parametrized Unit Tests and their Customization, I’d like to publish an update:

I received an interesting comment by Peli, that the following code piece should be replaced by a lambda expression, in order to make it more readable. Hence, I’d advice that you should just replace the following snippet:

  28:                 DeliverToAddressStringBook =
  29:                 delegate(String address, Book book)
  30:                 {
  31:                     count++;
  32:                 }
  

with the following:  

 

28:    DeliverToAddressStringBook = (address, book) => count++;

 

And in fact, using the lambda expression we could reduce the amount of code, hence making it more readable! Thanks, Peli!

Best regards,

Martin

Advertisements

Read Full Post »