July 2018
Beginner to intermediate
668 pages
16h 29m
English
When the for...in loop was introduced in Delphi 2005, the concept of enumerable types was also introduced into the Delphi language.
As you know, there are some built-in enumerable types; however, you can create your own enumerable types using a very simple pattern.
To make your container enumerable, implement a single method called GetEnumerator, which must return a reference to an object, interface, or record that implements the following two methods and one property (in the example, the element to enumerate is TFoo):
function GetCurrent: TFoo; function MoveNext: Boolean; property Current: TFoo read GetCurrent; ...
Read now
Unlock full access