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
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
Nice. How about a followup article, where T is a custom object, and the comparison custom as well? TMyObject.SomeComplexKeyThing...
ReplyDeletefor 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.
ReplyDeleteLars --
ReplyDeleteYeah, I can do that. ;-)
The virtues of TComparer :)
ReplyDeleteNice, 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