Why you should stop looping and start IEnumerable-ing.

Why you should stop looping and start IEnumerable-ing.

http://www.nickhodges.com/post/Loop-Less-with-IEnumerable-and-Spring-for-Delphi.aspx
http://www.nickhodges.com/post/Loop-Less-with-IEnumerable-and-Spring-for-Delphi.aspx

Comments

  1. Nice.  How about a followup article, where T is a custom object, and the comparison custom as well?  TMyObject.SomeComplexKeyThing...

    ReplyDelete
  2. for x in y is elegant enough for me when you really do need to call foo(x) for every x in y, but for solutions that are providing a single element result like your Max example, the point is well taken.

    ReplyDelete
  3. Nice, I wish I discovered this before massively using Generics.Collections. Maybe my remedy would be adding a helper for TList with a bunch of similar methods such as ForEach(), Filter, and so on.

    ReplyDelete

Post a Comment